Probing backround service follow-up.#1004
Conversation
|
👋 Thanks for assigning @tnull as a reviewer! |
tnull
left a comment
There was a problem hiding this comment.
One comment otherwise LGTM
| .checked_mul(channel_update_info.fees.proportional_millionths as u64) | ||
| .map(|v| v / 1_000_000)?; | ||
| let fee = (channel_update_info.fees.base_msat as u64).checked_add(proportional_fee)?; | ||
| forwarded = forwarded.checked_add(fee)?; |
There was a problem hiding this comment.
Codex:
[P2] Check the HTLC bound before adding the current hop’s fee — /home/tnull/worktrees/ldk-node/pr-1004-latest-20260724/src/probing.rs:698
forwarded initially represents the amount sent through next_channel, including only downstream fees. The code adds the current node’s fee and then compares against that channel’s bounds. That fee is collected on the preceding channel and must not count toward
next_channel.htlc_maximum_msat.For example, if B→C has a 1,000,000-msat maximum and B charges 1,000 msat, delivering exactly 1,000,000 msat over B→C is valid. This code checks 1,001,000 and rejects the path.
BOLT 7 defines the maximum as what the origin node will send through that channel, while its fee is calculated from amount_to_forward. BOLT 7 channel updates and HTLC fees (https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#htlc-fees)
The bound check should occur before calculating and adding fee.
Move probing code in builder before the memory leak checker. Prevent potential overflow due to public channel info fee values. Account aggregated fee potentially being bigger than constructed porbing path's max htlc bound.
415befb to
5dec4e7
Compare
Closes: #975
Move probing code in builder before the memory leak checker.
Prevent potential overflow due to public channel info fee values.
Account for aggregated fee potentially being bigger than constructed probing path's max htlc bound (doing second pass once we constructed path with fees).