Skip to content

Conversation

rustyrussell
Copy link
Contributor

We got the nSequence wrong if there's a lease in progress. Increase test coverage, and then make the two fixes where we used the "to-self-delay" (which is correct for the non-lease case).

Fixes: #7460

…se time.

What we expect to happen:

1. l3, which unilaterally closed, waits 4032 blocks (minus those mined) before
   trying to send get its "to_local" funds back.
2. This should then succeed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…too early (leases).

current height + to_self_delay[LOCAL] is correct normally, but if we
have an outstanding lease it's longer.  Not a big issue, because
lightningd will retry until its spendable, but wrong.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
If the nSequence in the tx it produces is not at least the value we
test in the script, the tx will always fail:

```
error code: -26\nerror message:\nmandatory-script-verify-flag-failed (Locktime requirement not satisfied)
```

If we have a lease, the nSequence is max(lease-time-remaining,
to-self-delay), so have onchaind tell lightningd the correct nSequence.

Fixes: ElementsProject#7460
Reported-by: https://github.com/pabpas
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: Correctly collect our own (delayed) funds if we have a unilateral close when we are still offering a lease.
@rustyrussell rustyrussell added Type::Bug An error, flaw, or fault that produces an incorrect or unexpected result channel-lease labels Feb 24, 2025
@rustyrussell rustyrussell added this to the v25.02 milestone Feb 24, 2025
@rustyrussell rustyrussell merged commit 79b28eb into ElementsProject:master Feb 24, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type::Bug An error, flaw, or fault that produces an incorrect or unexpected result
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ONCHAIN: 1 outputs unresolved: waiting confirmation that we spent DELAYED_OUTPUT_TO_US using OUR_DELAYED_RETURN_TO_WALLET
1 participant