mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-16 13:00:19 +02:00
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.
310 lines
5.8 KiB
Go
310 lines
5.8 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package sqlc
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
)
|
|
|
|
type AmpSubInvoice struct {
|
|
SetID []byte
|
|
State int16
|
|
CreatedAt time.Time
|
|
SettledAt sql.NullTime
|
|
SettleIndex sql.NullInt64
|
|
InvoiceID int64
|
|
}
|
|
|
|
type AmpSubInvoiceHtlc struct {
|
|
InvoiceID int64
|
|
SetID []byte
|
|
HtlcID int64
|
|
RootShare []byte
|
|
ChildIndex int64
|
|
Hash []byte
|
|
Preimage []byte
|
|
}
|
|
|
|
type GraphChannel struct {
|
|
ID int64
|
|
Version int16
|
|
Scid []byte
|
|
NodeID1 int64
|
|
NodeID2 int64
|
|
Outpoint string
|
|
Capacity sql.NullInt64
|
|
BitcoinKey1 []byte
|
|
BitcoinKey2 []byte
|
|
Node1Signature []byte
|
|
Node2Signature []byte
|
|
Bitcoin1Signature []byte
|
|
Bitcoin2Signature []byte
|
|
Signature []byte
|
|
FundingPkScript []byte
|
|
MerkleRootHash []byte
|
|
}
|
|
|
|
type GraphChannelExtraType struct {
|
|
ChannelID int64
|
|
Type int64
|
|
Value []byte
|
|
}
|
|
|
|
type GraphChannelFeature struct {
|
|
ChannelID int64
|
|
FeatureBit int32
|
|
}
|
|
|
|
type GraphChannelPolicy struct {
|
|
ID int64
|
|
Version int16
|
|
ChannelID int64
|
|
NodeID int64
|
|
Timelock int32
|
|
FeePpm int64
|
|
BaseFeeMsat int64
|
|
MinHtlcMsat int64
|
|
MaxHtlcMsat sql.NullInt64
|
|
LastUpdate sql.NullInt64
|
|
Disabled sql.NullBool
|
|
InboundBaseFeeMsat sql.NullInt64
|
|
InboundFeeRateMilliMsat sql.NullInt64
|
|
MessageFlags sql.NullInt16
|
|
ChannelFlags sql.NullInt16
|
|
Signature []byte
|
|
BlockHeight sql.NullInt64
|
|
DisableFlags sql.NullInt16
|
|
}
|
|
|
|
type GraphChannelPolicyExtraType struct {
|
|
ChannelPolicyID int64
|
|
Type int64
|
|
Value []byte
|
|
}
|
|
|
|
type GraphClosedScid struct {
|
|
Scid []byte
|
|
}
|
|
|
|
type GraphNode struct {
|
|
ID int64
|
|
Version int16
|
|
PubKey []byte
|
|
Alias sql.NullString
|
|
LastUpdate sql.NullInt64
|
|
Color sql.NullString
|
|
Signature []byte
|
|
BlockHeight sql.NullInt64
|
|
}
|
|
|
|
type GraphNodeAddress struct {
|
|
NodeID int64
|
|
Type int16
|
|
Position int32
|
|
Address string
|
|
}
|
|
|
|
type GraphNodeExtraType struct {
|
|
NodeID int64
|
|
Type int64
|
|
Value []byte
|
|
}
|
|
|
|
type GraphNodeFeature struct {
|
|
NodeID int64
|
|
FeatureBit int32
|
|
}
|
|
|
|
type GraphPruneLog struct {
|
|
BlockHeight int64
|
|
BlockHash []byte
|
|
}
|
|
|
|
type GraphSourceNode struct {
|
|
NodeID int64
|
|
}
|
|
|
|
type GraphZombieChannel struct {
|
|
Scid []byte
|
|
Version int16
|
|
NodeKey1 []byte
|
|
NodeKey2 []byte
|
|
}
|
|
|
|
type Invoice struct {
|
|
ID int64
|
|
Hash []byte
|
|
Preimage []byte
|
|
SettleIndex sql.NullInt64
|
|
SettledAt sql.NullTime
|
|
Memo sql.NullString
|
|
AmountMsat int64
|
|
CltvDelta sql.NullInt32
|
|
Expiry int32
|
|
PaymentAddr []byte
|
|
PaymentRequest sql.NullString
|
|
PaymentRequestHash []byte
|
|
State int16
|
|
AmountPaidMsat int64
|
|
IsAmp bool
|
|
IsHodl bool
|
|
IsKeysend bool
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type InvoiceEvent struct {
|
|
ID int64
|
|
AddedAt time.Time
|
|
EventType int32
|
|
InvoiceID int64
|
|
SetID []byte
|
|
}
|
|
|
|
type InvoiceEventType struct {
|
|
ID int64
|
|
Description string
|
|
}
|
|
|
|
type InvoiceFeature struct {
|
|
Feature int32
|
|
InvoiceID int64
|
|
}
|
|
|
|
type InvoiceHtlc struct {
|
|
ID int64
|
|
ChanID string
|
|
HtlcID int64
|
|
AmountMsat int64
|
|
TotalMppMsat sql.NullInt64
|
|
AcceptHeight int32
|
|
AcceptTime time.Time
|
|
ExpiryHeight int32
|
|
State int16
|
|
ResolveTime sql.NullTime
|
|
InvoiceID int64
|
|
}
|
|
|
|
type InvoiceHtlcCustomRecord struct {
|
|
Key int64
|
|
Value []byte
|
|
HtlcID int64
|
|
}
|
|
|
|
type InvoicePaymentHash struct {
|
|
ID int64
|
|
AddIndex int64
|
|
Hash []byte
|
|
}
|
|
|
|
type InvoiceSequence struct {
|
|
Name string
|
|
CurrentValue int64
|
|
}
|
|
|
|
type MigrationTracker struct {
|
|
Version int32
|
|
MigrationTime time.Time
|
|
}
|
|
|
|
type Payment struct {
|
|
ID int64
|
|
AmountMsat int64
|
|
CreatedAt time.Time
|
|
PaymentIdentifier []byte
|
|
FailReason sql.NullInt32
|
|
}
|
|
|
|
type PaymentAttemptFirstHopCustomRecord struct {
|
|
ID int64
|
|
HtlcAttemptIndex int64
|
|
Key int64
|
|
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
|
|
Key int64
|
|
Value []byte
|
|
}
|
|
|
|
type PaymentHopCustomRecord struct {
|
|
ID int64
|
|
HopID int64
|
|
Key int64
|
|
Value []byte
|
|
}
|
|
|
|
type PaymentHtlcAttempt struct {
|
|
ID int64
|
|
AttemptIndex int64
|
|
PaymentID int64
|
|
SessionKey []byte
|
|
AttemptTime time.Time
|
|
PaymentHash []byte
|
|
FirstHopAmountMsat int64
|
|
RouteTotalTimeLock int32
|
|
RouteTotalAmount int64
|
|
RouteSourceKey []byte
|
|
}
|
|
|
|
type PaymentHtlcAttemptResolution struct {
|
|
AttemptIndex int64
|
|
ResolutionTime time.Time
|
|
ResolutionType int32
|
|
SettlePreimage []byte
|
|
FailureSourceIndex sql.NullInt32
|
|
HtlcFailReason sql.NullInt32
|
|
FailureMsg []byte
|
|
}
|
|
|
|
type PaymentIntent struct {
|
|
ID int64
|
|
PaymentID int64
|
|
IntentType int16
|
|
IntentPayload []byte
|
|
}
|
|
|
|
type PaymentRouteHop struct {
|
|
ID int64
|
|
HtlcAttemptIndex int64
|
|
HopIndex int32
|
|
PubKey []byte
|
|
Scid string
|
|
OutgoingTimeLock int32
|
|
AmtToForward int64
|
|
MetaData []byte
|
|
}
|
|
|
|
type PaymentRouteHopAmp struct {
|
|
HopID int64
|
|
RootShare []byte
|
|
SetID []byte
|
|
ChildIndex int32
|
|
}
|
|
|
|
type PaymentRouteHopBlinded struct {
|
|
HopID int64
|
|
EncryptedData []byte
|
|
BlindingPoint []byte
|
|
BlindedPathTotalAmt sql.NullInt64
|
|
}
|
|
|
|
type PaymentRouteHopMpp struct {
|
|
HopID int64
|
|
PaymentAddr []byte
|
|
TotalMsat int64
|
|
}
|