diff --git a/contractcourt/htlc_incoming_contest_resolver.go b/contractcourt/htlc_incoming_contest_resolver.go index 9ffa799437e..9f39cf489d3 100644 --- a/contractcourt/htlc_incoming_contest_resolver.go +++ b/contractcourt/htlc_incoming_contest_resolver.go @@ -103,7 +103,10 @@ func (h *htlcIncomingContestResolver) Resolve( // // TODO(roasbeef): Implement resolving HTLCs with custom records // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { + if len(h.htlc.CustomRecords) != 0 && h.isTapscriptRoot { + log.Warnf("Not resolving HTLC with: %v custom records", + len(h.htlc.CustomRecords)) + select { //nolint:gosimple case <-h.quit: return nil, errResolverShuttingDown diff --git a/contractcourt/htlc_outgoing_contest_resolver.go b/contractcourt/htlc_outgoing_contest_resolver.go index c75b898222d..1ab9338033b 100644 --- a/contractcourt/htlc_outgoing_contest_resolver.go +++ b/contractcourt/htlc_outgoing_contest_resolver.go @@ -62,7 +62,10 @@ func (h *htlcOutgoingContestResolver) Resolve( // // TODO(roasbeef): Implement resolving HTLCs with custom records // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { + if len(h.htlc.CustomRecords) != 0 && h.isTapscriptRoot { + log.Warnf("Not resolving HTLC with: %v custom records", + len(h.htlc.CustomRecords)) + select { //nolint:gosimple case <-h.quit: return nil, errResolverShuttingDown diff --git a/contractcourt/htlc_success_resolver.go b/contractcourt/htlc_success_resolver.go index 3b07828d484..434c1710cdc 100644 --- a/contractcourt/htlc_success_resolver.go +++ b/contractcourt/htlc_success_resolver.go @@ -54,6 +54,12 @@ type htlcSuccessResolver struct { // htlc contains information on the htlc that we are resolving on-chain. htlc channeldb.HTLC + // isTapscriptRoot indicates whether the htlc is on a TapscriptRoot + // channel type. + // TODO: remove this when incoming HTLCs with custom records can be + // resolved for this channel type + isTapscriptRoot bool + // currentReport stores the current state of the resolver for reporting // over the rpc interface. This should only be reported in case we have // a non-nil SignDetails on the htlcResolution, otherwise the nursery @@ -127,7 +133,10 @@ func (h *htlcSuccessResolver) Resolve( // // TODO(roasbeef): Implement resolving HTLCs with custom records // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { + if len(h.htlc.CustomRecords) != 0 && h.isTapscriptRoot { + log.Warnf("Not resolving incoming htlc with %v custom records", + len(h.htlc.CustomRecords)) + select { //nolint:gosimple case <-h.quit: return nil, errResolverShuttingDown @@ -739,6 +748,17 @@ func (h *htlcSuccessResolver) HtlcPoint() wire.OutPoint { func (h *htlcSuccessResolver) SupplementDeadline(_ fn.Option[int32]) { } +// SupplementState allows the user of a ContractResolver to supplement it with +// state required for the proper resolution of a contract. +// +// NOTE: Part of the ContractResolver interface. +func (h *htlcIncomingContestResolver) SupplementState( + state *channeldb.OpenChannel) { + + h.isTapscriptRoot = state.ChanType.HasTapscriptRoot() + h.htlcLeaseResolver.SupplementState(state) +} + // A compile time assertion to ensure htlcSuccessResolver meets the // ContractResolver interface. var _ htlcContractResolver = (*htlcSuccessResolver)(nil) diff --git a/contractcourt/htlc_timeout_resolver.go b/contractcourt/htlc_timeout_resolver.go index 670da607d4a..9271de52fea 100644 --- a/contractcourt/htlc_timeout_resolver.go +++ b/contractcourt/htlc_timeout_resolver.go @@ -50,6 +50,12 @@ type htlcTimeoutResolver struct { // htlc contains information on the htlc that we are resolving on-chain. htlc channeldb.HTLC + // isTapscriptRoot indicates whether the htlc is on a TapscriptRoot + // channel type. + // TODO: remove this when incoming HTLCs with custom records can be + // resolved for this channel type + isTapscriptRoot bool + // currentReport stores the current state of the resolver for reporting // over the rpc interface. This should only be reported in case we have // a non-nil SignDetails on the htlcResolution, otherwise the nursery @@ -430,7 +436,10 @@ func (h *htlcTimeoutResolver) Resolve( // // TODO(roasbeef): Implement resolving HTLCs with custom records // (follow-up PR). - if len(h.htlc.CustomRecords) != 0 { + if len(h.htlc.CustomRecords) != 0 && h.isTapscriptRoot { + log.Warnf("Not resolving incoming htlc with %v custom records", + len(h.htlc.CustomRecords)) + select { //nolint:gosimple case <-h.quit: return nil, errResolverShuttingDown @@ -1095,6 +1104,15 @@ func (h *htlcTimeoutResolver) SupplementDeadline(d fn.Option[int32]) { h.incomingHTLCExpiryHeight = d } +// SupplementState allows the user of a ContractResolver to supplement it with +// state required for the proper resolution of a contract. +// +// NOTE: Part of the ContractResolver interface. +func (h *htlcTimeoutResolver) SupplementState(state *channeldb.OpenChannel) { + h.isTapscriptRoot = state.ChanType.HasTapscriptRoot() + h.htlcLeaseResolver.SupplementState(state) +} + // A compile time assertion to ensure htlcTimeoutResolver meets the // ContractResolver interface. var _ htlcContractResolver = (*htlcTimeoutResolver)(nil)