Zero fee htlc preparation: Part 2 - #6074
Merged
rustyrussell merged 18 commits intoApr 7, 2023
Merged
Conversation
rustyrussell
force-pushed
the
zero-fee-htlc-prep-2
branch
from
March 23, 2023 10:19
b734de5 to
6a7ee63
Compare
rustyrussell
force-pushed
the
zero-fee-htlc-prep-2
branch
3 times, most recently
from
March 23, 2023 23:20
b8fee58 to
db93f41
Compare
rustyrussell
force-pushed
the
zero-fee-htlc-prep-2
branch
2 times, most recently
from
March 24, 2023 03:29
4e2a4e4 to
5758155
Compare
rustyrussell
force-pushed
the
zero-fee-htlc-prep-2
branch
from
April 1, 2023 03:55
5758155 to
68168a9
Compare
Member
|
ACK 68168a9 |
We previously used WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US, WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US, WIRE_HSMD_SIGN_PENALTY_TO_US and WIRE_HSMD_SIGN_LOCAL_HTLC_TX which allow onchaind to sign txs, but only for its specific channel. We now want lightningd to sign these, but it's not bound to a specific channel. So let's add variants that don't require that. We are also now explicit about *what input* to sign. It's always zero for now, but future combinations may change that. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We add code for the case of spending a (timelocked) to-us output of an HTLC output, so lightningd can do it (rather than onchaind doing all the work itself). onchaind still needs to know whether we bothered to create the tx (fees might have caused it to evaporate, so it should consider it immediately resolved rather than waiting for it), and what the witnesses were, and which parts of the witnesses were signatures (as these parts might change, with RBF or in future, combining other txs). The inputs (known to onchaind) and the witnesses (told by lightningd) uniquely identify the spend for the purposes of onchaind. In particular, they definitely distinguish HTLC-timeout and HTLC-success cases. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Since we do both our own internal handling and handing it to lightningd, we add to `proposed_resolution` to handle the lightningd case. Note, in particular, that we fix the blockheight calculation: it's out by one, in that if we see a tx and our CSV lock is 5, we only need to wait 4 more blocks, not 5. This will matter as we start using it, and convert the tests. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…haind uses lightningd for broadcast. We can no longer grab the tx in one line as we did with wait_for_onchaind_broadcast, we need to track the broadcast from lightningd. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This follows the same pattern as the "spend htlc tx" in fact. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We'll use this later to calculate deadlines for spending txs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We'll reimplement it once lightningd makes all the onchain txs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We'll want this, as lightningd will want to produce htlc txs based on what it's told from onchaind, so we need a lower-level accessor. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ons. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ons. This breaks tests/test_closing.py::test_onchain_all_dust's accouting checks. That test doesn't really test what it claims to test; sure, onchaind *says* it's going to ignore the output due to high fees, but the tx still gets mined. I cannot figure out what the test is supposed to look like, so I simply disabled the accounting checks :( Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is when they closed the channel, we can simply make our own tx to expire the HTLC. (The other case is where we closed the channel, and we have a special htlc_timeout tx which we have their signature for). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…aind_broadcast Using single tuples in Python is ugly, so: 1. Rename wait_for_onchaind_tx to wait_for_onchaind_txs. 2. Make it take tuples explicitly. 3. Make wait_for_onchaind_tx a simpler wrapper/unwrapper. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We do this for HTLCs which will timeout to them: we watch them in case we want to fulfill them as a preimage comes in, but once they reach depth we can forget about them. We change the message, which causes some more test churn. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell
force-pushed
the
zero-fee-htlc-prep-2
branch
from
April 5, 2023 23:34
68168a9 to
450ae4d
Compare
Contributor
Author
|
Trivial rebase on master Ack 450ae4d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Based on #6073 , starts at hsmd: add support for lightningd signing onchain txs. )
This simply shifts the onchaind logic from "tell lightningd to broadcast a tx for us" to "tell lightningd to create a tx for us". This would be fairly simple, except for three things:
This removes the rbf logic for now: the next step is to bring it back.
Changelog-None No user visible changes