Count zero-fee-commitments channels in anchor reserve check#4592
Conversation
`can_support_additional_anchor_channel` decides whether the wallet has enough on-chain reserve to back another anchor channel by counting the node's existing anchor channels. The classification only checked the `anchors_zero_fee_htlc_tx` feature, so channels negotiated with the `anchor_zero_fee_commitments` (TRUC / 0FC, option 41) variant — which require the same on-chain reserve to fund commitment / HTLC fee bumps on force-close — were silently dropped from the count. A node enabling `negotiate_anchor_zero_fee_commitments` would therefore be green-lit to open more anchor channels than its wallet can actually back, risking unfunded fee bumps and HTLC loss on simultaneous force-closes. Treat both feature flags as marking a channel as an anchor channel for reserve-accounting purposes (factored into a small `is_anchor_channel_type` helper, used in both the chain-monitor and channel-manager loops), and add a regression test that opens a single 0FC channel with reserves sized for exactly one channel and asserts the function refuses to authorize a second. Co-Authored-By: HAL 9000
|
👋 I see @tankyleo was un-assigned. |
|
No issues found. The fix is correct: Cross-cutting observation (pre-existing, outside this PR's diff): Several weight functions in |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4592 +/- ##
==========================================
- Coverage 86.84% 86.27% -0.57%
==========================================
Files 161 159 -2
Lines 109260 109197 -63
Branches 109260 109197 -63
==========================================
- Hits 94882 94210 -672
- Misses 11797 12374 +577
- Partials 2581 2613 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
can_support_additional_anchor_channeldecides whether the wallet has enough on-chain reserve to back another anchor channel by counting the node's existing anchor channels. The classification only checked theanchors_zero_fee_htlc_txfeature, so channels negotiated with theanchor_zero_fee_commitments(TRUC / 0FC, option 41) variant — which require the same on-chain reserve to fund commitment / HTLC fee bumps on force-close — were silently dropped from the count.A node enabling
negotiate_anchor_zero_fee_commitmentswould therefore be green-lit to open more anchor channels than its wallet can actually back, risking unfunded fee bumps and HTLC loss on simultaneous force-closes.Treat both feature flags as marking a channel as an anchor channel for reserve-accounting purposes (factored into a small
is_anchor_channel_typehelper, used in both the chain-monitor and channel-manager loops), and add a regression test that opens a single 0FC channel with reserves sized for exactly one channel and asserts the function refuses to authorize a second.Co-Authored-By: HAL 9000