What changed, and why it matters
This commit adds a small helper function used only in tests. It creates a test-only object for constructing Lightning Network payment descriptors with specific values. There is no change to production code, no user-facing behavior change, and no security fix or vulnerability introduced.
No security action required. Review as normal test-only code if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces NewTestAuxHtlcDescriptor in lnwallet/aux_test_utils.go, a constructor that returns an AuxHtlcDescriptor populated with supplied parameters, including normally unexported commit-height fields. It is intended for external test packages that need to exercise AuxHtlcView. The function is purely test infrastructure.
Changed components
lnwallet/aux_test_utils.goInspect captured patch +31 / −0
diff --git a/lnwallet/aux_test_utils.go b/lnwallet/aux_test_utils.go
new file mode 100644
index 0000000..1e76a52
--- /dev/null
+++ b/lnwallet/aux_test_utils.go
@@ -0,0 +1,31 @@
+package lnwallet
+
+import (
+ "github.com/lightningnetwork/lnd/lnwire"
+)
+
+// NewTestAuxHtlcDescriptor creates an AuxHtlcDescriptor for testing purposes.
+// This function allows tests to create descriptors with specific commit heights
+// and entry types, which are normally unexported fields.
+func NewTestAuxHtlcDescriptor(chanID lnwire.ChannelID,
+ rHash PaymentHash, timeout uint32,
+ amount lnwire.MilliSatoshi, htlcIndex, parentIndex uint64,
+ entryType uint8, customRecords lnwire.CustomRecords,
+ addHeightLocal, addHeightRemote, removeHeightLocal,
+ removeHeightRemote uint64) AuxHtlcDescriptor {
+
+ return AuxHtlcDescriptor{
+ ChanID: chanID,
+ RHash: rHash,
+ Timeout: timeout,
+ Amount: amount,
+ HtlcIndex: htlcIndex,
+ ParentIndex: parentIndex,
+ EntryType: updateType(entryType),
+ CustomRecords: customRecords,
+ addCommitHeightLocal: addHeightLocal,
+ addCommitHeightRemote: addHeightRemote,
+ removeCommitHeightLocal: removeHeightLocal,
+ removeCommitHeightRemote: removeHeightRemote,
+ }
+}
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.