What changed, and why it matters
This commit is a simple spelling cleanup. It renames a field called 'OutgoingCTLV' to the correctly spelled 'OutgoingCLTV' throughout the codebase and fixes related typos in comments. CLTV stands for 'CheckLockTimeVerify,' a Bitcoin time-lock feature. There is no functional change to how the software behaves.
No security action needed. This is a non-functional refactor. Normal code review and merge procedures apply.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is a pure identifier rename of ForwardingInfo.OutgoingCTLV to OutgoingCLTV across 14 files, plus comment typo fixes. The diff shows only mechanical replacements and no logic changes. Serialization/deserialization code in htlcswitch/mock.go was updated to read/write the renamed field, preserving the same binary format. Tests were updated to use the new field name.
Changed components
htlcswitch/hop/forwarding_info.gohtlcswitch/link.gocontractcourt/htlc_incoming_contest_resolver.gowitness_beacon.gohtlcswitch/mock.goInspect captured patch +29 / −27
diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go
index f17d873..380ccb9 100644
--- a/contractcourt/channel_arbitrator.go
+++ b/contractcourt/channel_arbitrator.go
@@ -1432,7 +1432,7 @@ func (c *ChannelArbitrator) sweepAnchors(anchors *lnwallet.AnchorResolutions,
// HTLCs, or,
// - half of the least CLTV from incoming HTLCs if the preimage is available.
//
-// We use half of the CTLV value to ensure that we have enough time to sweep
+// We use half of the CLTV value to ensure that we have enough time to sweep
// the second-level HTLCs.
//
// It also finds the total value that are time-sensitive, which is the sum of
diff --git a/contractcourt/htlc_incoming_contest_resolver.go b/contractcourt/htlc_incoming_contest_resolver.go
index e5047c7..3ee8cd6 100644
--- a/contractcourt/htlc_incoming_contest_resolver.go
+++ b/contractcourt/htlc_incoming_contest_resolver.go
@@ -213,7 +213,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
"expected_expiry=%v, height=%v, max=%v), resolving as "+
"failed", h, h.htlcResolution.ClaimOutpoint,
h.htlc.Amt, payload.FwdInfo.AmountToForward,
- h.htlcExpiry, payload.FwdInfo.OutgoingCTLV,
+ h.htlcExpiry, payload.FwdInfo.OutgoingCLTV,
currentHeight, invoices.MaxFinalCltvDelta)
h.markResolved()
diff --git a/graph/db/models/channel.go b/graph/db/models/channel.go
index 2069d16..abe4c3b 100644
--- a/graph/db/models/channel.go
+++ b/graph/db/models/channel.go
@@ -123,7 +123,7 @@ type ForwardingPolicy struct {
// create the time-lock value for the forwarded outgoing HTLC. The
// following constraint MUST hold for an HTLC to be forwarded:
//
- // * incomingHtlc.timeLock - timeLockDelta = fwdInfo.OutgoingCTLV
+ // * incomingHtlc.timeLock - timeLockDelta = fwdInfo.OutgoingCLTV
//
// where fwdInfo is the forwarding information extracted from the
// per-hop payload of the incoming HTLC's onion packet.
diff --git a/htlcswitch/hop/forwarding_info.go b/htlcswitch/hop/forwarding_info.go
index 2bb380d..f46b924 100644
--- a/htlcswitch/hop/forwarding_info.go
+++ b/htlcswitch/hop/forwarding_info.go
@@ -20,9 +20,9 @@ type ForwardingInfo struct {
// node should forward to the next hop.
AmountToForward lnwire.MilliSatoshi
- // OutgoingCTLV is the specified value of the CTLV timelock to be used
+ // OutgoingCLTV is the specified value of the CLTV timelock to be used
// in the outgoing HTLC.
- OutgoingCTLV uint32
+ OutgoingCLTV uint32
// NextBlinding is an optional blinding point to be passed to the next
// node in UpdateAddHtlc. This field is set if the htlc is part of a
@@ -71,7 +71,7 @@ func ValidateFinalHtlc(amt lnwire.MilliSatoshi, expiry, heightNow,
// The HTLC expiry is below the final CLTV requested by the onion
// payload.
- case expiry < fwdInfo.OutgoingCTLV:
+ case expiry < fwdInfo.OutgoingCLTV:
return FinalHtlcInvalidCltv
// The HTLC expiry is outside the supported final-hop CLTV range.
diff --git a/htlcswitch/hop/forwarding_info_test.go b/htlcswitch/hop/forwarding_info_test.go
index 68ac6f2..82a5ad0 100644
--- a/htlcswitch/hop/forwarding_info_test.go
+++ b/htlcswitch/hop/forwarding_info_test.go
@@ -20,7 +20,7 @@ func TestValidateFinalHtlc(t *testing.T) {
fwdInfo := ForwardingInfo{
AmountToForward: amount,
- OutgoingCTLV: expiry,
+ OutgoingCLTV: expiry,
NextHop: Exit,
}
@@ -114,7 +114,7 @@ func TestValidateFinalHtlc(t *testing.T) {
maxCltvDelta: maxCltvDelta,
fwdInfo: ForwardingInfo{
AmountToForward: amount,
- OutgoingCTLV: expiry + maxCltvDelta + 2,
+ OutgoingCLTV: expiry + maxCltvDelta + 2,
NextHop: Exit,
},
validateAmount: true,
diff --git a/htlcswitch/hop/fuzz_test.go b/htlcswitch/hop/fuzz_test.go
index 7cfc30a..bafede0 100644
--- a/htlcswitch/hop/fuzz_test.go
+++ b/htlcswitch/hop/fuzz_test.go
@@ -88,7 +88,7 @@ func FuzzOnionPacket(f *testing.F) {
func hopFromPayload(p *Payload) (*route.Hop, uint64) {
return &route.Hop{
AmtToForward: p.FwdInfo.AmountToForward,
- OutgoingTimeLock: p.FwdInfo.OutgoingCTLV,
+ OutgoingTimeLock: p.FwdInfo.OutgoingCLTV,
MPP: p.MPP,
AMP: p.AMP,
Metadata: p.metadata,
diff --git a/htlcswitch/hop/iterator.go b/htlcswitch/hop/iterator.go
index cc539fe..ada071e 100644
--- a/htlcswitch/hop/iterator.go
+++ b/htlcswitch/hop/iterator.go
@@ -327,7 +327,7 @@ func deriveBlindedRouteForwardingInfo(r *sphinxHopIterator,
payload.FwdInfo = ForwardingInfo{
NextHop: nextSCID.Val,
AmountToForward: fwdAmt,
- OutgoingCTLV: r.blindingKit.IncomingCltv - uint32(
+ OutgoingCLTV: r.blindingKit.IncomingCltv - uint32(
relayInfo.Val.CltvExpiryDelta,
),
// Remap from blinding override type to blinding point type.
diff --git a/htlcswitch/hop/iterator_test.go b/htlcswitch/hop/iterator_test.go
index e3d1efd..e60aa16 100644
--- a/htlcswitch/hop/iterator_test.go
+++ b/htlcswitch/hop/iterator_test.go
@@ -35,7 +35,7 @@ func TestSphinxHopIteratorForwardingInstructions(t *testing.T) {
expectedFwdInfo := ForwardingInfo{
NextHop: lnwire.NewShortChanIDFromInt(nextAddrInt),
AmountToForward: lnwire.MilliSatoshi(hopData.ForwardAmount),
- OutgoingCTLV: hopData.OutgoingCltv,
+ OutgoingCLTV: hopData.OutgoingCltv,
}
// For our TLV payload, we'll serialize the hop into into a TLV stream
diff --git a/htlcswitch/hop/payload.go b/htlcswitch/hop/payload.go
index 052cf18..dccbc3a 100644
--- a/htlcswitch/hop/payload.go
+++ b/htlcswitch/hop/payload.go
@@ -128,7 +128,7 @@ func NewLegacyPayload(f *sphinx.HopData) *Payload {
FwdInfo: ForwardingInfo{
NextHop: lnwire.NewShortChanIDFromInt(nextHop),
AmountToForward: lnwire.MilliSatoshi(f.ForwardAmount),
- OutgoingCTLV: f.OutgoingCltv,
+ OutgoingCLTV: f.OutgoingCltv,
},
customRecords: make(record.CustomSet),
}
@@ -203,7 +203,7 @@ func ParseTLVPayload(r io.Reader) (*Payload, map[tlv.Type][]byte, error) {
FwdInfo: ForwardingInfo{
NextHop: lnwire.NewShortChanIDFromInt(cid),
AmountToForward: lnwire.MilliSatoshi(amt),
- OutgoingCTLV: cltv,
+ OutgoingCLTV: cltv,
},
MPP: mpp,
AMP: amp,
diff --git a/htlcswitch/link.go b/htlcswitch/link.go
index bc665c9..0b4516d 100644
--- a/htlcswitch/link.go
+++ b/htlcswitch/link.go
@@ -3232,7 +3232,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
// Otherwise, it was already processed, we can
// can collect it and continue.
outgoingAdd := &lnwire.UpdateAddHTLC{
- Expiry: fwdInfo.OutgoingCTLV,
+ Expiry: fwdInfo.OutgoingCLTV,
Amount: fwdInfo.AmountToForward,
PaymentHash: add.PaymentHash,
BlindingPoint: fwdInfo.NextBlinding,
@@ -3271,7 +3271,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
htlc: outgoingAdd,
obfuscator: obfuscator,
incomingTimeout: add.Expiry,
- outgoingTimeout: fwdInfo.OutgoingCTLV,
+ outgoingTimeout: fwdInfo.OutgoingCLTV,
inOnionCustomRecords: pld.CustomRecords(),
inboundFee: inboundFee,
inWireCustomRecords: add.CustomRecords.Copy(),
@@ -3290,7 +3290,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
// create the outgoing HTLC using the parameters as
// specified in the forwarding info.
addMsg := &lnwire.UpdateAddHTLC{
- Expiry: fwdInfo.OutgoingCTLV,
+ Expiry: fwdInfo.OutgoingCLTV,
Amount: fwdInfo.AmountToForward,
PaymentHash: add.PaymentHash,
BlindingPoint: fwdInfo.NextBlinding,
@@ -3348,7 +3348,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
htlc: addMsg,
obfuscator: obfuscator,
incomingTimeout: add.Expiry,
- outgoingTimeout: fwdInfo.OutgoingCTLV,
+ outgoingTimeout: fwdInfo.OutgoingCLTV,
inOnionCustomRecords: pld.CustomRecords(),
inboundFee: inboundFee,
inWireCustomRecords: add.CustomRecords.Copy(),
@@ -3477,7 +3477,7 @@ func (l *channelLink) processExitHop(add lnwire.UpdateAddHTLC,
case hop.FinalHtlcInvalidCltv:
l.log.Errorf("onion payload of incoming htlc(%x) has "+
"incompatible time-lock: expected <=%v, got %v",
- add.PaymentHash, add.Expiry, fwdInfo.OutgoingCTLV)
+ add.PaymentHash, add.Expiry, fwdInfo.OutgoingCLTV)
failure := NewLinkError(
lnwire.NewFinalIncorrectCltvExpiry(add.Expiry),
diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go
index d065bbb..fdc455f 100644
--- a/htlcswitch/link_test.go
+++ b/htlcswitch/link_test.go
@@ -779,13 +779,13 @@ func testChannelLinkInboundFee(t *testing.T, //nolint:thelper
NextHop: n.carolChannelLink.
ShortChanID(),
AmountToForward: 1_000_000,
- OutgoingCTLV: 106,
+ OutgoingCLTV: 106,
},
},
{
FwdInfo: hop.ForwardingInfo{
AmountToForward: 1_000_000,
- OutgoingCTLV: 106,
+ OutgoingCLTV: 106,
},
},
}
@@ -973,7 +973,7 @@ func TestExitNodeHTLCTimelockExceedsPayload(t *testing.T) {
// The proper value of the outgoing CLTV should be the policy set by
// the receiving node, instead we set it to be a value less than the
// incoming HTLC timelock.
- hops[0].FwdInfo.OutgoingCTLV = htlcExpiry - 1
+ hops[0].FwdInfo.OutgoingCLTV = htlcExpiry - 1
firstHop := n.firstBobChannelLink.ShortChanID()
_, err = makePayment(
n.aliceServer, n.bobServer, firstHop, hops, amount, htlcAmt,
@@ -1011,7 +1011,7 @@ func TestExitNodeTimelockPayloadExceedsHTLC(t *testing.T) {
// The proper value of the outgoing CLTV should be the policy set by
// the receiving node, instead we set it to be a value greater than the
// incoming HTLC timelock.
- hops[0].FwdInfo.OutgoingCTLV = htlcExpiry + 1
+ hops[0].FwdInfo.OutgoingCLTV = htlcExpiry + 1
firstHop := n.firstBobChannelLink.ShortChanID()
_, err = makePayment(
n.aliceServer, n.bobServer, firstHop, hops, amount, htlcAmt,
diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go
index 637f3e2..e9be926 100644
--- a/htlcswitch/mock.go
+++ b/htlcswitch/mock.go
@@ -375,7 +375,8 @@ func encodeFwdInfo(w io.Writer, f *hop.ForwardingInfo) error {
return err
}
- if err := binary.Write(w, binary.BigEndian, f.OutgoingCTLV); err != nil {
+ err := binary.Write(w, binary.BigEndian, f.OutgoingCLTV)
+ if err != nil {
return err
}
@@ -514,7 +515,7 @@ func (p *mockIteratorDecoder) DecodeHopIterator(r io.Reader, rHash []byte,
Realm: [1]byte{}, // hop.BitcoinNetwork
NextAddress: nextHopBytes,
ForwardAmount: uint64(f.AmountToForward),
- OutgoingCltv: f.OutgoingCTLV,
+ OutgoingCltv: f.OutgoingCLTV,
})
}
@@ -569,7 +570,8 @@ func decodeFwdInfo(r io.Reader, f *hop.ForwardingInfo) error {
return err
}
- if err := binary.Read(r, binary.BigEndian, &f.OutgoingCTLV); err != nil {
+ err := binary.Read(r, binary.BigEndian, &f.OutgoingCLTV)
+ if err != nil {
return err
}
diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go
index 2f66fed..93d16b3 100644
--- a/htlcswitch/switch_test.go
+++ b/htlcswitch/switch_test.go
@@ -3597,7 +3597,7 @@ func getThreeHopEvents(channels *clusterChannels, htlcID uint64,
bobInfo := HtlcInfo{
IncomingTimeLock: htlc.Expiry,
IncomingAmt: htlc.Amount,
- OutgoingTimeLock: hops[1].FwdInfo.OutgoingCTLV,
+ OutgoingTimeLock: hops[1].FwdInfo.OutgoingCLTV,
OutgoingAmt: hops[1].FwdInfo.AmountToForward,
}
diff --git a/witness_beacon.go b/witness_beacon.go
index 6c315d0..eba0bca 100644
--- a/witness_beacon.go
+++ b/witness_beacon.go
@@ -102,7 +102,7 @@ func (p *preimageBeacon) SubscribeUpdates(
HtlcID: htlc.HtlcIndex,
},
OutgoingChanID: payload.FwdInfo.NextHop,
- OutgoingExpiry: payload.FwdInfo.OutgoingCTLV,
+ OutgoingExpiry: payload.FwdInfo.OutgoingCLTV,
OutgoingAmount: payload.FwdInfo.AmountToForward,
InOnionCustomRecords: payload.CustomRecords(),
InWireCustomRecords: htlc.CustomRecords,
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.