Skip to content

Commit 975326a

Browse files
committed
askrene: round capacity *down* when converting to fp16.
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]>
1 parent af011f9 commit 975326a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/askrene/askrene.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ static fp16_t *get_capacities(const tal_t *ctx,
169169
"get_capacity failed for channel?");
170170
cap = AMOUNT_SAT(0);
171171
}
172+
/* Pessimistic: round down! */
172173
caps[gossmap_chan_idx(gossmap, c)]
173-
= u64_to_fp16(cap.satoshis, true); /* Raw: fp16 */
174+
= u64_to_fp16(cap.satoshis, false); /* Raw: fp16 */
174175
}
175176
return caps;
176177
}

0 commit comments

Comments
 (0)