payments/db: normalize LegacyPayload flag in migration comparison

LegacyPayload was a hint used exclusively by the KV store to decide
how to serialize and deserialize the hop payload (legacy format vs
TLV). The SQL store does not serialize hop data at all — every hop
field is persisted natively in its own column — so this flag has no
meaning there and is never stored.

Clear LegacyPayload for all hops inside normalizePaymentForCompare so
that deep-equality checks between KV and SQL payments succeed even when
the KV source data carries LegacyPayload=true.

A dedicated test (TestMigrationLegacyPayloadNormalized) is added to
verify that a payment with LegacyPayload=true hops migrates and
compares correctly.
This commit is contained in:
ziggie committed 2026-02-26 17:38:33 +01:00
1 parent cf3610abb9
commit 00025ef3bf
2 files changed
+181

No files matched your search

@@ -320,6 +320,15 @@ func normalizePaymentForCompare(payment *MPPayment) {
htlc.Route.Hops[j].CustomRecords =
record.CustomSet{}
}
// LegacyPayload was a hint used by the KV store to
// determine how to serialize and deserialize the hop
// payload (i.e. whether to use the legacy format or
// TLV). The SQL store does not serialize hop data at
// all — each field is stored natively in its own
// column — so this flag has no meaning there and is
// never persisted.
htlc.Route.Hops[j].LegacyPayload = false
}
}
}