Skip to content

Commit

Permalink
askrene: round capacity *down* when converting to fp16.
Browse files Browse the repository at this point in the history
Conversion is lossy, and we don't want to spend more than the channel,
so it's conservative to round down here.

This doesn't actually help our test though!

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Aug 23, 2024
1 parent af011f9 commit 975326a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/askrene/askrene.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ static fp16_t *get_capacities(const tal_t *ctx,
"get_capacity failed for channel?");
cap = AMOUNT_SAT(0);
}
/* Pessimistic: round down! */
caps[gossmap_chan_idx(gossmap, c)]
= u64_to_fp16(cap.satoshis, true); /* Raw: fp16 */
= u64_to_fp16(cap.satoshis, false); /* Raw: fp16 */
}
return caps;
}
Expand Down

0 comments on commit 975326a

Please sign in to comment.