Skip to content

Fix edge case in availableBalanceForSend/Receive#3308

Open
t-bast wants to merge 1 commit intomasterfrom
fix-available-for-send-receive
Open

Fix edge case in availableBalanceForSend/Receive#3308
t-bast wants to merge 1 commit intomasterfrom
fix-available-for-send-receive

Conversation

@t-bast
Copy link
Copy Markdown
Member

@t-bast t-bast commented May 11, 2026

There was a small discrepancy between availableBalanceForSend/Receive and canSendAdd/canReceiveAdd when the sender is not paying the commit tx fees. In canSendAdd/canReceiveAdd, we verify that the receiver (who pays the commit fees) can still pay those fees after adding the new HTLC to the commit tx. In availableBalanceForSend/Receive, we did not verify that.

This only happens in very rare cases where the receiver is paying the commit fees and is very close this its channel reserve, so it should rarely happen in practice, but it sometimes makes our fuzz tests fail.

There was a small discrepancy between `availableBalanceForSend/Receive`
and `canSendAdd/canReceiveAdd` when the sender is not paying the commit
tx fees. In `canSendAdd/canReceiveAdd`, we verify that the receiver
(who pays the commit fees) can still pay those fees after adding the
new HTLC to the commit tx. In `availableBalanceForSend/Receive`, we did
not verify that.

This only happens in very rare cases where the receiver is paying the
commit fees and is very close this its channel reserve, so it should
rarely happen in practice, but it sometimes makes our fuzz tests fail.
@t-bast t-bast requested review from pm47 and sstone May 11, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant