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:
7 files changed
+195
-1
No files matched your search
@@ -224,6 +224,16 @@ type PaymentAttemptFirstHopCustomRecord struct {
|
||||
Value []byte
|
||||
}
|
||||
|
||||
type PaymentDuplicate struct {
|
||||
ID int64
|
||||
PaymentID int64
|
||||
AmountMsat int64
|
||||
CreatedAt time.Time
|
||||
FailReason sql.NullInt32
|
||||
SettlePreimage []byte
|
||||
SettleTime sql.NullTime
|
||||
}
|
||||
|
||||
type PaymentFirstHopCustomRecord struct {
|
||||
ID int64
|
||||
PaymentID int64
|
||||
|
||||
Reference in new issue
Block a user