diff --git a/contractcourt/htlc_incoming_contest_resolver.go b/contractcourt/htlc_incoming_contest_resolver.go index 9ffa79943..6bda4e398 100644 --- a/contractcourt/htlc_incoming_contest_resolver.go +++ b/contractcourt/htlc_incoming_contest_resolver.go @@ -99,17 +99,6 @@ func (h *htlcIncomingContestResolver) Resolve( return nil, nil } - // If the HTLC has custom records, then for now we'll pause resolution. - // - // TODO(roasbeef): Implement resolving HTLCs with custom records - // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { - select { //nolint:gosimple - case <-h.quit: - return nil, errResolverShuttingDown - } - } - // First try to parse the payload. If that fails, we can stop resolution // now. payload, nextHopOnionBlob, err := h.decodePayload() diff --git a/contractcourt/htlc_lease_resolver.go b/contractcourt/htlc_lease_resolver.go index 87e55d5cc..53fa89355 100644 --- a/contractcourt/htlc_lease_resolver.go +++ b/contractcourt/htlc_lease_resolver.go @@ -6,7 +6,9 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" + "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/tlv" ) // htlcLeaseResolver is a struct that houses the lease specific HTLC resolution @@ -52,8 +54,8 @@ func (h *htlcLeaseResolver) deriveWaitHeight(csvDelay uint32, // send to the sweeper so the output can ultimately be swept. func (h *htlcLeaseResolver) makeSweepInput(op *wire.OutPoint, wType, cltvWtype input.StandardWitnessType, - signDesc *input.SignDescriptor, - csvDelay, broadcastHeight uint32, payHash [32]byte) *input.BaseInput { + signDesc *input.SignDescriptor, csvDelay, broadcastHeight uint32, + payHash [32]byte, resBlob fn.Option[tlv.Blob]) *input.BaseInput { if h.hasCLTV() { log.Infof("%T(%x): CSV and CLTV locks expired, offering "+ @@ -63,13 +65,17 @@ func (h *htlcLeaseResolver) makeSweepInput(op *wire.OutPoint, op, cltvWtype, signDesc, broadcastHeight, csvDelay, h.leaseExpiry, + input.WithResolutionBlob(resBlob), ) } log.Infof("%T(%x): CSV lock expired, offering second-layer output to "+ "sweeper: %v", h, payHash, op) - return input.NewCsvInput(op, wType, signDesc, broadcastHeight, csvDelay) + return input.NewCsvInput( + op, wType, signDesc, broadcastHeight, csvDelay, + input.WithResolutionBlob(resBlob), + ) } // SupplementState allows the user of a ContractResolver to supplement it with diff --git a/contractcourt/htlc_outgoing_contest_resolver.go b/contractcourt/htlc_outgoing_contest_resolver.go index c75b89822..2466544c9 100644 --- a/contractcourt/htlc_outgoing_contest_resolver.go +++ b/contractcourt/htlc_outgoing_contest_resolver.go @@ -58,17 +58,6 @@ func (h *htlcOutgoingContestResolver) Resolve( return nil, nil } - // If the HTLC has custom records, then for now we'll pause resolution. - // - // TODO(roasbeef): Implement resolving HTLCs with custom records - // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { - select { //nolint:gosimple - case <-h.quit: - return nil, errResolverShuttingDown - } - } - // Otherwise, we'll watch for two external signals to decide if we'll // morph into another resolver, or fully resolve the contract. // diff --git a/contractcourt/htlc_success_resolver.go b/contractcourt/htlc_success_resolver.go index 3b07828d4..4c9d2b200 100644 --- a/contractcourt/htlc_success_resolver.go +++ b/contractcourt/htlc_success_resolver.go @@ -123,17 +123,6 @@ func (h *htlcSuccessResolver) Resolve( return nil, nil } - // If the HTLC has custom records, then for now we'll pause resolution. - // - // TODO(roasbeef): Implement resolving HTLCs with custom records - // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { - select { //nolint:gosimple - case <-h.quit: - return nil, errResolverShuttingDown - } - } - // If we don't have a success transaction, then this means that this is // an output on the remote party's commitment transaction. if h.htlcResolution.SignedSuccessTx == nil { @@ -258,6 +247,9 @@ func (h *htlcSuccessResolver) broadcastReSignedSuccessTx(immediate bool) ( h.htlcResolution.SignedSuccessTx, h.htlcResolution.SignDetails, h.htlcResolution.Preimage, h.broadcastHeight, + input.WithResolutionBlob( + h.htlcResolution.ResolutionBlob, + ), ) } else { //nolint:lll @@ -414,7 +406,7 @@ func (h *htlcSuccessResolver) broadcastReSignedSuccessTx(immediate bool) ( input.LeaseHtlcAcceptedSuccessSecondLevel, &h.htlcResolution.SweepSignDesc, h.htlcResolution.CsvDelay, uint32(commitSpend.SpendingHeight), - h.htlc.RHash, + h.htlc.RHash, h.htlcResolution.ResolutionBlob, ) // Calculate the budget for this sweep. @@ -470,6 +462,9 @@ func (h *htlcSuccessResolver) resolveRemoteCommitOutput(immediate bool) ( h.htlcResolution.Preimage[:], h.broadcastHeight, h.htlcResolution.CsvDelay, + input.WithResolutionBlob( + h.htlcResolution.ResolutionBlob, + ), )) } else { inp = lnutils.Ptr(input.MakeHtlcSucceedInput( diff --git a/contractcourt/htlc_timeout_resolver.go b/contractcourt/htlc_timeout_resolver.go index 670da607d..f2de5f4a3 100644 --- a/contractcourt/htlc_timeout_resolver.go +++ b/contractcourt/htlc_timeout_resolver.go @@ -426,17 +426,6 @@ func (h *htlcTimeoutResolver) Resolve( return nil, nil } - // If the HTLC has custom records, then for now we'll pause resolution. - // - // TODO(roasbeef): Implement resolving HTLCs with custom records - // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { - select { //nolint:gosimple - case <-h.quit: - return nil, errResolverShuttingDown - } - } - // Start by spending the HTLC output, either by broadcasting the // second-level timeout transaction, or directly if this is the remote // commitment. @@ -495,6 +484,9 @@ func (h *htlcTimeoutResolver) sweepSecondLevelTx(immediate bool) error { h.htlcResolution.SignedTimeoutTx, h.htlcResolution.SignDetails, h.broadcastHeight, + input.WithResolutionBlob( + h.htlcResolution.ResolutionBlob, + ), )) } else { inp = lnutils.Ptr(input.MakeHtlcSecondLevelTimeoutAnchorInput( @@ -588,6 +580,7 @@ func (h *htlcTimeoutResolver) sweepDirectHtlcOutput(immediate bool) error { &h.htlcResolution.ClaimOutpoint, htlcWitnessType, &h.htlcResolution.SweepSignDesc, h.broadcastHeight, h.htlcResolution.CsvDelay, h.htlcResolution.Expiry, + input.WithResolutionBlob(h.htlcResolution.ResolutionBlob), ) // Calculate the budget. @@ -842,6 +835,7 @@ func (h *htlcTimeoutResolver) handleCommitSpend( &h.htlcResolution.SweepSignDesc, h.htlcResolution.CsvDelay, uint32(commitSpend.SpendingHeight), h.htlc.RHash, + h.htlcResolution.ResolutionBlob, ) // Calculate the budget for this sweep.