-
Notifications
You must be signed in to change notification settings - Fork 2.3k
contractcourt: only halt resolution for TapscriptRoot channels #9208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. think we can already get the info using the scripts, copied from other PRs, // isTaproot returns true if the htlc output is a taproot output.
func (h *htlcTimeoutResolver) isTaproot() bool {
return txscript.IsPayToTaproot(
h.htlcResolution.SweepSignDesc.Output.PkScript,
)
}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah you are right these are two different things. In that case do you think it's possible to pass the boolean when creating the resolvers so we don't need the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is how we currently go about relaunching after startup. We don't have I think we should just always do it that way for consistency?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah that's a design i'm trying to fix, pre-exiting so no worries. |
||
|
|
||
| // 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) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we could just check
h.isTapscriptRoothere as our check?Happy to remove the
CustomRecordscheck if it's useful, but since this is a to-be-removed workaround I didn't think it matters that much (and more specific = more good?).