Skip to content

Commit 8824244

Browse files
committed
contracourt: rename broadcastHeight to confirmHeight
The broadcastHeight was misleading because the commit resolver is only created when the commitment transaction is confirmed.
1 parent 8c8662c commit 8824244

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

contractcourt/briefcase_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ func assertResolversEqual(t *testing.T, originalResolver ContractResolver,
278278
t.Fatalf("expected %v, got %v", ogRes.resolved.Load(),
279279
diskRes.resolved.Load())
280280
}
281-
if ogRes.broadcastHeight != diskRes.broadcastHeight {
281+
if ogRes.confirmHeight != diskRes.confirmHeight {
282282
t.Fatalf("expected %v, got %v",
283-
ogRes.broadcastHeight, diskRes.broadcastHeight)
283+
ogRes.confirmHeight, diskRes.confirmHeight)
284284
}
285285
if ogRes.chanPoint != diskRes.chanPoint {
286286
t.Fatalf("expected %v, got %v", ogRes.chanPoint,
@@ -341,8 +341,8 @@ func TestContractInsertionRetrieval(t *testing.T) {
341341
SelfOutputSignDesc: testSignDesc,
342342
MaturityDelay: 99,
343343
},
344-
broadcastHeight: 109,
345-
chanPoint: testChanPoint1,
344+
confirmHeight: 109,
345+
chanPoint: testChanPoint1,
346346
}
347347
commitResolver.resolved.Store(false)
348348

contractcourt/commit_sweep_resolver.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ type commitSweepResolver struct {
3838
// this HTLC on-chain.
3939
commitResolution lnwallet.CommitOutputResolution
4040

41-
// broadcastHeight is the height that the original contract was
42-
// broadcast to the main-chain at. We'll use this value to bound any
43-
// historical queries to the chain for spends/confirmations.
44-
broadcastHeight uint32
41+
// confirmHeight is the block height that the commitment transaction was
42+
// confirmed at. We'll use this value to bound any historical queries to
43+
// the chain for spends/confirmations.
44+
confirmHeight uint32
4545

4646
// chanPoint is the channel point of the original contract.
4747
chanPoint wire.OutPoint
@@ -74,13 +74,13 @@ type commitSweepResolver struct {
7474

7575
// newCommitSweepResolver instantiates a new direct commit output resolver.
7676
func newCommitSweepResolver(res lnwallet.CommitOutputResolution,
77-
broadcastHeight uint32, chanPoint wire.OutPoint,
77+
confirmHeight uint32, chanPoint wire.OutPoint,
7878
resCfg ResolverConfig) *commitSweepResolver {
7979

8080
r := &commitSweepResolver{
8181
contractResolverKit: *newContractResolverKit(resCfg),
8282
commitResolution: res,
83-
broadcastHeight: broadcastHeight,
83+
confirmHeight: confirmHeight,
8484
chanPoint: chanPoint,
8585
}
8686

@@ -133,7 +133,7 @@ func (c *commitSweepResolver) getCommitTxConfHeight() (uint32, error) {
133133
const confDepth = 1
134134

135135
confChan, err := c.Notifier.RegisterConfirmationsNtfn(
136-
&txID, pkScript, confDepth, c.broadcastHeight,
136+
&txID, pkScript, confDepth, c.confirmHeight,
137137
)
138138
if err != nil {
139139
return 0, err
@@ -268,7 +268,7 @@ func (c *commitSweepResolver) Encode(w io.Writer) error {
268268
if err := binary.Write(w, endian, c.IsResolved()); err != nil {
269269
return err
270270
}
271-
if err := binary.Write(w, endian, c.broadcastHeight); err != nil {
271+
if err := binary.Write(w, endian, c.confirmHeight); err != nil {
272272
return err
273273
}
274274
if _, err := w.Write(c.chanPoint.Hash[:]); err != nil {
@@ -308,7 +308,7 @@ func newCommitSweepResolverFromReader(r io.Reader, resCfg ResolverConfig) (
308308
c.markResolved()
309309
}
310310

311-
if err := binary.Read(r, endian, &c.broadcastHeight); err != nil {
311+
if err := binary.Read(r, endian, &c.confirmHeight); err != nil {
312312
return nil, err
313313
}
314314
_, err := io.ReadFull(r, c.chanPoint.Hash[:])
@@ -412,7 +412,7 @@ func (c *commitSweepResolver) Launch() error {
412412
inp = input.NewCsvInputWithCltv(
413413
&c.commitResolution.SelfOutPoint, witnessType,
414414
&c.commitResolution.SelfOutputSignDesc,
415-
c.broadcastHeight, c.commitResolution.MaturityDelay,
415+
c.confirmHeight, c.commitResolution.MaturityDelay,
416416
c.leaseExpiry, input.WithResolutionBlob(
417417
c.commitResolution.ResolutionBlob,
418418
),
@@ -421,7 +421,7 @@ func (c *commitSweepResolver) Launch() error {
421421
inp = input.NewCsvInput(
422422
&c.commitResolution.SelfOutPoint, witnessType,
423423
&c.commitResolution.SelfOutputSignDesc,
424-
c.broadcastHeight, c.commitResolution.MaturityDelay,
424+
c.confirmHeight, c.commitResolution.MaturityDelay,
425425
input.WithResolutionBlob(
426426
c.commitResolution.ResolutionBlob,
427427
),

0 commit comments

Comments
 (0)