Skip to content

Conversation

@sstone
Copy link
Member

@sstone sstone commented Apr 28, 2025

The goal of this PR is to simplify how we create and spend LN transactions (HTLC success/timeout, pemality transactions, ...) by refactoring how we create "redeem info" (information needed to spend specific outputs).

The biggest change is that redeemInfo is removed from our InputInfo class:

  • when we create local/remote commit transactions, we create the entire "commit tx + 2nd level HTLC txs" tree once, including relevant spending information that we pass along. This solves the type design problem that was highlighted in Refactor output redeem type from TransactionWithInputInfo #3056 and Add high-level helpers for taproot channels #3028)
  • we add the extra HTLC information that we need (expiry and/or payment hash) to HtlcSuccessTx, HtlcTimeoutTx, and ClaimHtlcTimeoutTx, and update codecs to store this information
  • For data that stored with previous codecs, we extract this information from the redeem script that was included in the old InputInfo class, or from the transaction's witness. These transactions were signed and published so this info has to be there.

This PR includes tooling support for taproot channels (i.e. solvers already implement signing/spending taproot transactions) , which helps validate whether this approach is suitable and extensible enough, but does not include code to actually create live taproot channels.

Codecs have been updated, payment hash and expiry fields that have been added to some of our class will be extracted either from the redeem script that we used to persist or from the transaction's witness (they're all p2wsh transactions).

@sstone sstone requested a review from t-bast April 28, 2025 16:36
sstone added 2 commits April 29, 2025 23:04
We update CommitmentOutput to include the actual output that it represents in the commit tx, and the redeem script to spend it.
We also include 2nd level HTLC transactions when they are not trimmed.
We remove CommitmentOutputLink which is now useless, and simplify how we create commitment and HTLC transactions.
We add solvers to create and sign spending transactions, and remove makeXXXTx() aand addSigs() methods.
@sstone sstone force-pushed the refactor-solvers branch from 3019c61 to 6e40c49 Compare April 29, 2025 21:06
…nd ClaimHtlcTimeoutTx

We previously saved the redeem script in the InputInfo class: we'll extract these fields from
the redeem script (which would be an HTLC offered or received script) or witness of data persisted with older codecs.
@sstone sstone force-pushed the refactor-solvers branch from 6e40c49 to 94ce2e2 Compare April 30, 2025 09:47
@sstone sstone marked this pull request as ready for review April 30, 2025 14:03
@sstone
Copy link
Member Author

sstone commented May 7, 2025

closed in favour of #3074

@sstone sstone closed this May 7, 2025
@sstone sstone deleted the refactor-solvers branch May 7, 2025 15:21
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.

2 participants