sqldb+payments: add payment_duplicates for legacy duplicate payments

Older LND versions could create multiple payments for the same hash.
We need to preserve those historical records during KV→SQL migration,
but they don’t fit the normal payment schema because we enforce a
unique payment hash constraint. Introduce a lean payment_duplicates
table to store only the essential fields (identifier, amount,
timestamps, settle/fail data).

This keeps the primary payment records stable and makes the migration
deterministic even when duplicate records lack attempt info. The table
is intentionally minimal and can be dropped after migration if no
duplicate payments exist.

For now there is no logic in place which allows the noderunner to
fetch duplicate payments after the migration.
This commit is contained in:
ziggie committed 2026-02-25 18:52:32 +01:00
1 parent 2596d34619
commit 74f8f2d9e6
7 files changed
+195 -1

No files matched your search

@@ -0,0 +1,2 @@
DROP INDEX IF EXISTS idx_payment_duplicates_payment_id;
DROP TABLE IF EXISTS payment_duplicates;