Expose channel reserve in open channel requests#4731
Conversation
|
I've assigned @valentinewallace as a reviewer! |
| let channel_value_satoshis = msg.common_fields.funding_satoshis; | ||
| let channel_reserve_satoshis = channel::get_v2_channel_reserve_satoshis( | ||
| channel_value_satoshis, | ||
| channel::MIN_CHAN_DUST_LIMIT_SATOSHIS, | ||
| msg.disable_channel_reserve.is_some(), |
There was a problem hiding this comment.
For V2 dual-funded channels the reserve is computed from only the peer's funding_satoshis, but the reserve actually enforced on the holder is derived at accept time from the total channel value (our_funding_contribution + msg.funding_satoshis, see InboundV2Channel::new). If the acceptor contributes funds (as is the whole point of dual funding), the value exposed here will be lower than the reserve that ultimately applies. At event time the acceptor's contribution isn't known yet, so this can't be fully accurate — but worth documenting on the field/changelog that for V2 this reflects only the initiator's contribution, otherwise consumers may rely on a value that doesn't match the final reserve.
|
I've re-reviewed the full PR against my prior findings. Verified:
No new issues found. Prior concerns status:
No additional bugs, security issues, or compilation breakage identified in this pass. |
Fixes #3909.
This exposes the channel reserve in
Event::OpenChannelRequest::paramsby addingchannel_reserve_satoshistomsgs::ChannelParameters.open_channel.channel_reserve_satoshis.disable_channel_reserve.CommonOpenChannelFieldsalone does not have to manufacture a fullChannelParameters.Validation run locally:
rustfmt +1.75.0 --check --edition 2021 lightning/src/ln/msgs.rs lightning/src/ln/channelmanager.rs lightning/src/ln/channel_open_tests.rscargo test -p lightning test_open_channel_request_exposes_v2_channel_reservecargo test -p lightning test_inbound_anchors_manual_acceptancecargo check -p lightninggit diff --checkNote:
cargo fmt --checkandcargo clippy -p lightning --tests -- -D warningscurrently report pre-existing formatting/lint output in unrelated files such aslightning/src/ln/channel.rsandlightning-macros/src/lib.rs; this PR does not touch those files.