File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
lightning/src/blinded_path Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -174,12 +174,12 @@ pub(super) fn compute_payinfo(
174
174
. and_then ( |f| f. checked_add ( 1_000_000 - 1 ) )
175
175
. map ( |f| f / 1_000_000 )
176
176
. ok_or ( ( ) ) ?;
177
- // (((curr_prop_mil + next_prop_mil) * 1_000_000 + curr_prop_mil * next_prop_mil) + 1_000_000 - 1) / 1_000_000
178
- curr_prop_mil = curr_prop_mil. checked_add ( next_prop_mil)
179
- . and_then ( |f| f. checked_mul ( 1_000_000 ) )
180
- . and_then ( |f| curr_prop_mil. checked_mul ( next_prop_mil) . and_then ( |prop_mil| prop_mil. checked_add ( f) ) )
177
+ // ceil(((curr_prop_mil + 1_000_000) * (next_prop_mil + 1_000_000)) / 1_000_000) - 1_000_000
178
+ curr_prop_mil = curr_prop_mil. checked_add ( 1_000_000 )
179
+ . and_then ( |f1| next_prop_mil. checked_add ( 1_000_000 ) . and_then ( |f2| f2. checked_mul ( f1) ) )
181
180
. and_then ( |f| f. checked_add ( 1_000_000 - 1 ) )
182
181
. map ( |f| f / 1_000_000 )
182
+ . and_then ( |f| f. checked_sub ( 1_000_000 ) )
183
183
. ok_or ( ( ) ) ?;
184
184
185
185
cltv_expiry_delta = cltv_expiry_delta. checked_add ( tlvs. payment_relay . cltv_expiry_delta ) . ok_or ( ( ) ) ?;
You can’t perform that action at this time.
0 commit comments