File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -3007,6 +3007,13 @@ where L::Target: Logger {
30073007 . saturating_add( old_entry. path_penalty_msat) ;
30083008 let new_fee_cost = cmp:: max( total_fee_msat, path_htlc_minimum_msat)
30093009 . saturating_add( path_penalty_msat) ;
3010+ // The actual score we use for our heap is the cost divided by how
3011+ // much we are thinking of sending over this channel. This avoids
3012+ // prioritizing channels that have a very low fee because we aren't
3013+ // sending very much over them.
3014+ // In order to avoid integer division precision loss, we simply
3015+ // shift the costs up to the top half of a u128 and divide by the
3016+ // value (which is, at max, just under a u64).
30103017 let old_cost = if old_fee_cost != u64 :: MAX && old_entry. value_contribution_msat != 0 {
30113018 ( ( old_fee_cost as u128 ) << 64 ) / old_entry. value_contribution_msat as u128
30123019 } else {
You can’t perform that action at this time.
0 commit comments