contracourt: rename broadcastHeight to confirmHeight
What changed, and why it matters
This commit is a simple variable rename from broadcastHeight to confirmHeight, plus updated comments, in the Lightning Network Daemon (LND) contract court code. It does not change any program logic, behavior, or security properties. The rename makes the code easier to understand because the value actually stores the block height at which the commitment transaction was confirmed, not the height it was broadcast.
No security action needed. Treat as a normal code-quality/refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames the commitSweepResolver struct field broadcastHeight to confirmHeight and updates all references, including constructor parameter, serialization/deserialization, test assertions, and comments. The functional code paths (RegisterConfirmationsNtfn, NewCsvInput/NewCsvInputWithCltv) use the same value as before; only the identifier changed. No algorithmic, cryptographic, or protocol change is present.
Changed components
contractcourt/commit_sweep_resolver.gocontractcourt/briefcase_test.goInspect captured patch +15 / −15
diff --git a/contractcourt/briefcase_test.go b/contractcourt/briefcase_test.go
index 3dfc155..c86bffb 100644
--- a/contractcourt/briefcase_test.go
+++ b/contractcourt/briefcase_test.go
@@ -278,9 +278,9 @@ func assertResolversEqual(t *testing.T, originalResolver ContractResolver,
t.Fatalf("expected %v, got %v", ogRes.resolved.Load(),
diskRes.resolved.Load())
}
- if ogRes.broadcastHeight != diskRes.broadcastHeight {
+ if ogRes.confirmHeight != diskRes.confirmHeight {
t.Fatalf("expected %v, got %v",
- ogRes.broadcastHeight, diskRes.broadcastHeight)
+ ogRes.confirmHeight, diskRes.confirmHeight)
}
if ogRes.chanPoint != diskRes.chanPoint {
t.Fatalf("expected %v, got %v", ogRes.chanPoint,
@@ -341,8 +341,8 @@ func TestContractInsertionRetrieval(t *testing.T) {
SelfOutputSignDesc: testSignDesc,
MaturityDelay: 99,
},
- broadcastHeight: 109,
- chanPoint: testChanPoint1,
+ confirmHeight: 109,
+ chanPoint: testChanPoint1,
}
commitResolver.resolved.Store(false)
diff --git a/contractcourt/commit_sweep_resolver.go b/contractcourt/commit_sweep_resolver.go
index 0f2cb6b..04dce47 100644
--- a/contractcourt/commit_sweep_resolver.go
+++ b/contractcourt/commit_sweep_resolver.go
@@ -38,10 +38,10 @@ type commitSweepResolver struct {
// this HTLC on-chain.
commitResolution lnwallet.CommitOutputResolution
- // broadcastHeight is the height that the original contract was
- // broadcast to the main-chain at. We'll use this value to bound any
- // historical queries to the chain for spends/confirmations.
- broadcastHeight uint32
+ // confirmHeight is the block height that the commitment transaction was
+ // confirmed at. We'll use this value to bound any historical queries to
+ // the chain for spends/confirmations.
+ confirmHeight uint32
// chanPoint is the channel point of the original contract.
chanPoint wire.OutPoint
@@ -74,13 +74,13 @@ type commitSweepResolver struct {
// newCommitSweepResolver instantiates a new direct commit output resolver.
func newCommitSweepResolver(res lnwallet.CommitOutputResolution,
- broadcastHeight uint32, chanPoint wire.OutPoint,
+ confirmHeight uint32, chanPoint wire.OutPoint,
resCfg ResolverConfig) *commitSweepResolver {
r := &commitSweepResolver{
contractResolverKit: *newContractResolverKit(resCfg),
commitResolution: res,
- broadcastHeight: broadcastHeight,
+ confirmHeight: confirmHeight,
chanPoint: chanPoint,
}
@@ -133,7 +133,7 @@ func (c *commitSweepResolver) getCommitTxConfHeight() (uint32, error) {
const confDepth = 1
confChan, err := c.Notifier.RegisterConfirmationsNtfn(
- &txID, pkScript, confDepth, c.broadcastHeight,
+ &txID, pkScript, confDepth, c.confirmHeight,
)
if err != nil {
return 0, err
@@ -268,7 +268,7 @@ func (c *commitSweepResolver) Encode(w io.Writer) error {
if err := binary.Write(w, endian, c.IsResolved()); err != nil {
return err
}
- if err := binary.Write(w, endian, c.broadcastHeight); err != nil {
+ if err := binary.Write(w, endian, c.confirmHeight); err != nil {
return err
}
if _, err := w.Write(c.chanPoint.Hash[:]); err != nil {
@@ -308,7 +308,7 @@ func newCommitSweepResolverFromReader(r io.Reader, resCfg ResolverConfig) (
c.markResolved()
}
- if err := binary.Read(r, endian, &c.broadcastHeight); err != nil {
+ if err := binary.Read(r, endian, &c.confirmHeight); err != nil {
return nil, err
}
_, err := io.ReadFull(r, c.chanPoint.Hash[:])
@@ -412,7 +412,7 @@ func (c *commitSweepResolver) Launch() error {
inp = input.NewCsvInputWithCltv(
&c.commitResolution.SelfOutPoint, witnessType,
&c.commitResolution.SelfOutputSignDesc,
- c.broadcastHeight, c.commitResolution.MaturityDelay,
+ c.confirmHeight, c.commitResolution.MaturityDelay,
c.leaseExpiry, input.WithResolutionBlob(
c.commitResolution.ResolutionBlob,
),
@@ -421,7 +421,7 @@ func (c *commitSweepResolver) Launch() error {
inp = input.NewCsvInput(
&c.commitResolution.SelfOutPoint, witnessType,
&c.commitResolution.SelfOutputSignDesc,
- c.broadcastHeight, c.commitResolution.MaturityDelay,
+ c.confirmHeight, c.commitResolution.MaturityDelay,
input.WithResolutionBlob(
c.commitResolution.ResolutionBlob,
),
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.