paymentsdb: fix test case before testing sql backend
What changed, and why it matters
This is a test-only adjustment that updates a fake payment route used in unit tests so it matches the new real-world behavior of LND: legacy onion payloads are no longer supported, only modern TLV-encoded payloads. It also adds a code comment and a TODO about eventually removing the now-deprecated LegacyPayload field. There is no runtime security fix here.
No security action required. This is a preparatory test/maintenance commit. Reviewers may verify the SQL backend migration commits that follow correctly handle any persisted legacy payloads.
Security signals we found
No production code behavior changed
Test fixture updated to reflect deprecated legacy payload support
Deprecation comment and TODO added for future field removal
Evidence from the diff
The commit changes a test fixture in payments/db/payment_test.go to set LegacyPayload=false on a test Hop, because LND no longer supports LegacyPayload onion packets and the upcoming SQL payments backend assumes TLV payloads. It also changes an assertion from require.Equal to require.ErrorIs, which is a more idiomatic Go error check. In routing/route/route.go it adds documentation noting LegacyPayload is deprecated and a TODO to remove it once the old kv backend is phased out. No production logic is altered.
Changed components
payments/db/payment_test.gorouting/route/route.goInspect captured patch +8 / −2
diff --git a/payments/db/payment_test.go b/payments/db/payment_test.go
index 2c2d668..df922a4 100644
--- a/payments/db/payment_test.go
+++ b/payments/db/payment_test.go
@@ -59,7 +59,10 @@ var (
ChannelID: 12345,
OutgoingTimeLock: 111,
AmtToForward: 555,
- LegacyPayload: true,
+
+ // Only tlv payloads are now supported in LND therefore we set
+ // LegacyPayload to false.
+ LegacyPayload: false,
}
testRoute = route.Route{
@@ -2203,7 +2206,7 @@ func TestMultiShard(t *testing.T) {
// Finally assert we cannot register more attempts.
_, err = paymentDB.RegisterAttempt(info.PaymentIdentifier, b)
- require.Equal(t, registerErr, err)
+ require.ErrorIs(t, err, registerErr)
}
for _, test := range tests {
diff --git a/routing/route/route.go b/routing/route/route.go
index 1bb52ba..a575c41 100644
--- a/routing/route/route.go
+++ b/routing/route/route.go
@@ -164,6 +164,9 @@ type Hop struct {
// The only reason we are keeping this member is that it could be the
// case that we have serialised hops persisted to disk where
// LegacyPayload is true.
+ //
+ // TODO(ziggie): Remove this field once we phase out the kv backend
+ // for payments.
LegacyPayload bool
// Metadata is additional data that is sent along with the payment to
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.