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(
174174 . and_then ( |f| f. checked_add ( 1_000_000 - 1 ) )
175175 . map ( |f| f / 1_000_000 )
176176 . 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) ) )
181180 . and_then ( |f| f. checked_add ( 1_000_000 - 1 ) )
182181 . map ( |f| f / 1_000_000 )
182+ . and_then ( |f| f. checked_sub ( 1_000_000 ) )
183183 . ok_or ( ( ) ) ?;
184184
185185 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