Describe the bug
When a session channel is opened but nothing is spent, closing it fails. The client sends a close with cumulativeAmount of 0, and the server rejects it with:
close voucher amount must be > 0 (on-chain settled)
The channel is already funded on chain at this point, so the deposit is stuck. The normal close flow gives no way to get it back.
This happens because validate_close_amount rejects any close where cumulativeAmount <= on_chain_settled. For an untouched channel both values are 0, so a valid zero-amount close is treated as an error. A close at the already settled amount should be allowed and should just refund the remaining deposit, matching the current behavior of the TypeScript SDK mppx.
Steps to reproduce
- Configure a server using the tempo session method with a funded
close_signer.
- From a client, open a session against a paid route. The open is folded into the first request, so the channel gets funded on chain.
- Make that first request fail, or otherwise not get billed, so the channel's spent stays at 0.
- Immediately send a close for the session with
cumulativeAmount of 0.
- The close is rejected with
close voucher amount must be > 0 (on-chain settled).
A more direct way to see the cause is the unit level:
- Call
validate_close_amount(0, 0, 0, deposit) where deposit is some positive value.
- It returns an error instead of
Ok.
The repo already has a test that locks in this behavior: test_close_at_zero_rejects_when_zero_settled in src/protocol/methods/tempo/session_method.rs asserts that the zero close is rejected.
Container Type
Not running in a container
What version/commit are you on?
Discovered in v0.10.4 release on crates.io, but persists up until the latest commit as of writing 30d1128
Code of Conduct
Describe the bug
When a session channel is opened but nothing is spent, closing it fails. The client sends a close with
cumulativeAmountof 0, and the server rejects it with:close voucher amount must be > 0 (on-chain settled)The channel is already funded on chain at this point, so the deposit is stuck. The normal close flow gives no way to get it back.
This happens because
validate_close_amountrejects any close wherecumulativeAmount <= on_chain_settled. For an untouched channel both values are 0, so a valid zero-amount close is treated as an error. A close at the already settled amount should be allowed and should just refund the remaining deposit, matching the current behavior of the TypeScript SDKmppx.Steps to reproduce
close_signer.cumulativeAmountof 0.close voucher amount must be > 0 (on-chain settled).A more direct way to see the cause is the unit level:
validate_close_amount(0, 0, 0, deposit)where deposit is some positive value.Ok.The repo already has a test that locks in this behavior:
test_close_at_zero_rejects_when_zero_settledinsrc/protocol/methods/tempo/session_method.rsasserts that the zero close is rejected.Container Type
Not running in a container
What version/commit are you on?
Discovered in
v0.10.4release on crates.io, but persists up until the latest commit as of writing30d1128Code of Conduct