Repository navigation
Sign our half of HTLC transactions SIGHASH_ALL on unified channels - #59
Merged
Merged
Conversation
kwsantiago
force-pushed
the
htlc-local-sighash-all
branch
from
October 19, 2026 17:27
0ede97a to
c25b519
Compare
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.
On a channel with
option_unified_sigs, BOLT 3 and BOLT 5 have the broadcaster sign its own half of an HTLC-success or HTLC-timeout transactionSIGHASH_ALL(0x21), with only the peer's halfSIGHASH_SINGLE|SIGHASH_ANYONECANPAY(0xa3under anchors). Our half was signed like the peer's. Since lightningd adds wallet inputs and change to fund these transactions, our signature now has to be made over the final transaction, and again on every fee bump.hsmd_sign_htlc_tx_mingle_unifiedsigns the wallet inputs and then the HTLC inputSIGHASH_ALL|SIGHASH_UNIFIEDover the final transaction. It checks the HTLC input and output indexes, that the input's script is the P2WSH of the given witness script, that no wallet utxo is the HTLC outpoint, and that every input carries consistent prevout data. lightningd uses it for each RBF of an HTLC transaction on a unified channel and refuses to start against an HSM without it.do_sign_local_htlc_tx, and the direct spends of HTLC outputs on the peer's commitment, signSIGHASH_ALL|SIGHASH_UNIFIEDon unified channels.option_unified_sigssign exactly as before.Tests: the unified witness check now requires
0x21for our half and0xa3for the peer's;test_unified_htlc_tx_rbfcovers success and timeout through two fee bumps and two restarts, requiring a fresh0x21signature on each version;test_htlc_tx_rbf_without_unified_sigspins the unchanged behavior without unified sigs; hsmd and sighash unit tests cover the new message and its refusals.Changelog-None