Skip to content

Commit 55cfb70

Browse files
Roasbeefguggero
authored andcommitted
contractcourt: pause resolution for HTLCs w/ custom records
This is a hold over until the aux resolution is finalized for HTLC outputs.
1 parent 9a7718e commit 55cfb70

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

contractcourt/htlc_incoming_contest_resolver.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ func (h *htlcIncomingContestResolver) Resolve(
9999
return nil, nil
100100
}
101101

102+
// If the HTLC has custom records, then for now we'll pause resolution.
103+
//
104+
// TODO(roasbeef): Implement resolving HTLCs with custom records
105+
// (follow-up PR).
106+
if len(h.htlc.CustomRecords) != 0 {
107+
select { //nolint:gosimple
108+
case <-h.quit:
109+
return nil, errResolverShuttingDown
110+
}
111+
}
112+
102113
// First try to parse the payload. If that fails, we can stop resolution
103114
// now.
104115
payload, nextHopOnionBlob, err := h.decodePayload()

contractcourt/htlc_outgoing_contest_resolver.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ func (h *htlcOutgoingContestResolver) Resolve(
5858
return nil, nil
5959
}
6060

61+
// If the HTLC has custom records, then for now we'll pause resolution.
62+
//
63+
// TODO(roasbeef): Implement resolving HTLCs with custom records
64+
// (follow-up PR).
65+
if len(h.htlc.CustomRecords) != 0 {
66+
select { //nolint:gosimple
67+
case <-h.quit:
68+
return nil, errResolverShuttingDown
69+
}
70+
}
71+
6172
// Otherwise, we'll watch for two external signals to decide if we'll
6273
// morph into another resolver, or fully resolve the contract.
6374
//

contractcourt/htlc_success_resolver.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ func (h *htlcSuccessResolver) Resolve(
123123
return nil, nil
124124
}
125125

126+
// If the HTLC has custom records, then for now we'll pause resolution.
127+
//
128+
// TODO(roasbeef): Implement resolving HTLCs with custom records
129+
// (follow-up PR).
130+
if len(h.htlc.CustomRecords) != 0 {
131+
select { //nolint:gosimple
132+
case <-h.quit:
133+
return nil, errResolverShuttingDown
134+
}
135+
}
136+
126137
// If we don't have a success transaction, then this means that this is
127138
// an output on the remote party's commitment transaction.
128139
if h.htlcResolution.SignedSuccessTx == nil {

contractcourt/htlc_timeout_resolver.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,17 @@ func (h *htlcTimeoutResolver) Resolve(
426426
return nil, nil
427427
}
428428

429+
// If the HTLC has custom records, then for now we'll pause resolution.
430+
//
431+
// TODO(roasbeef): Implement resolving HTLCs with custom records
432+
// (follow-up PR).
433+
if len(h.htlc.CustomRecords) != 0 {
434+
select { //nolint:gosimple
435+
case <-h.quit:
436+
return nil, errResolverShuttingDown
437+
}
438+
}
439+
429440
// Start by spending the HTLC output, either by broadcasting the
430441
// second-level timeout transaction, or directly if this is the remote
431442
// commitment.

0 commit comments

Comments
 (0)