Add AvailableBalances::next_splice_out_maximum_sat#4550
Add AvailableBalances::next_splice_out_maximum_sat#4550tankyleo wants to merge 5 commits intolightningdevkit:mainfrom
AvailableBalances::next_splice_out_maximum_sat#4550Conversation
We now validate that both commitments retain at least one output after a splice, which is crucial for zero-reserve channels.
We previously determined this value by subtracting the htlcs, the anchors, and the commitment transaction fee. This ignored the reserve, as well as the at-least-one-output requirement in zero-reserve channels. This new field now accounts for both of these constraints.
This is equivalent to the previous commit, see the debug assertions added in the previous commit. We now also get to communicate the exact maximum back to the user, instead of some "balance is lower than our reserve" message, which is hard to react to.
|
👋 Thanks for assigning @wpaulino as a reviewer! |
724acf9 to
3bd7a76
Compare
Review SummaryCorrection of Prior CommentsMy previous review flagged three "unit mismatch" bugs that were incorrect:
I apologize for the false positives. Still-Valid Prior CommentsThe following prior comments remain valid concerns:
New Issues FoundNo new issues found beyond those already covered by prior comments. The equation derivation for the v2 reserve constraint is correct, the feerate spike handling is consistent (no double-spike in the validation path), the accumulator logic for multi-funding channels correctly takes the minimum, and the semantic change from "holder balance floor" to "max splice-out" in |
|
Seems the fuzz failure produces this error on my machine Hex: Target: chanmon_consistency Error: |
This is the maximum value the holder can splice out of their channel balance, accounting for the updated v2 reserves after the splice, and the "must have at least one output" constraint on zero-reserve channels.