loop/loopdb/sqlc/models.go
Slyghtning 325545143c
staticaddr/loopin: persist risk decisions
Store the server's static loop-in confirmation-risk decision and the time it
was received. This lets recovered swaps reconstruct whether payment waiting had
already started and how much of the payment timeout remains.

Wire notification handling to persist accepted and rejected decisions before
caching and forwarding them. If the swap row is not present yet, the
notification is still cached so the per-swap waiter can replay and store the
decision later.

Recover accepted decisions by starting the payment deadline from the persisted
decision time, and recover rejected decisions by canceling the invoice and
failing the swap instead of waiting forever.
2026-06-01 10:46:52 +02:00

233 lines
5 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
package sqlc
import (
"database/sql"
"time"
)
type Deposit struct {
ID int32
DepositID []byte
TxHash []byte
OutIndex int32
Amount int64
ConfirmationHeight int64
TimeoutSweepPkScript []byte
ExpirySweepTxid []byte
FinalizedWithdrawalTx sql.NullString
SwapHash []byte
}
type DepositUpdate struct {
ID int32
DepositID []byte
UpdateState string
UpdateTimestamp time.Time
}
type HtlcKey struct {
SwapHash []byte
SenderScriptPubkey []byte
ReceiverScriptPubkey []byte
SenderInternalPubkey []byte
ReceiverInternalPubkey []byte
ClientKeyFamily int32
ClientKeyIndex int32
}
type InstantoutSwap struct {
SwapHash []byte
Preimage []byte
SweepAddress string
OutgoingChanSet string
HtlcFeeRate int64
ReservationIds []byte
SwapInvoice string
FinalizedHtlcTx []byte
SweepTxHash []byte
FinalizedSweeplessSweepTx []byte
SweepConfirmationHeight sql.NullInt32
}
type InstantoutUpdate struct {
ID int32
SwapHash []byte
UpdateState string
UpdateTimestamp time.Time
}
type LiquidityParam struct {
ID int32
Params []byte
}
type LoopinSwap struct {
SwapHash []byte
HtlcConfTarget int32
LastHop []byte
ExternalHtlc bool
}
type LoopoutSwap struct {
SwapHash []byte
DestAddress string
SwapInvoice string
MaxSwapRoutingFee int64
SweepConfTarget int32
HtlcConfirmations int32
OutgoingChanSet string
PrepayInvoice string
MaxPrepayRoutingFee int64
PublicationDeadline time.Time
SingleSweep bool
PaymentTimeout int32
}
type LoopoutSwapsAssetInfo struct {
SwapHash []byte
AssetID []byte
SwapRfqID []byte
PrepayRfqID []byte
AssetAmtPaidSwap int64
AssetAmtPaidPrepay int64
}
type MigrationTracker struct {
MigrationID string
MigrationTs sql.NullTime
}
type Reservation struct {
ID int32
ReservationID []byte
ClientPubkey []byte
ServerPubkey []byte
Expiry int32
Value int64
ClientKeyFamily int32
ClientKeyIndex int32
InitiationHeight int32
TxHash []byte
OutIndex sql.NullInt32
ConfirmationHeight sql.NullInt32
ProtocolVersion int32
}
type ReservationUpdate struct {
ID int32
ReservationID []byte
UpdateState string
UpdateTimestamp time.Time
}
type StaticAddress struct {
ID int32
ClientPubkey []byte
ServerPubkey []byte
Expiry int32
ClientKeyFamily int32
ClientKeyIndex int32
Pkscript []byte
ProtocolVersion int32
InitiationHeight int32
}
type StaticAddressSwap struct {
ID int32
SwapHash []byte
SwapInvoice string
LastHop []byte
PaymentTimeoutSeconds int32
QuotedSwapFeeSatoshis int64
DepositOutpoints string
HtlcTxFeeRateSatKw int64
HtlcTimeoutSweepTxID sql.NullString
HtlcTimeoutSweepAddress string
SelectedAmount int64
Fast bool
ConfirmationRiskDecision string
ConfirmationRiskDecisionTime sql.NullTime
}
type StaticAddressSwapUpdate struct {
ID int32
SwapHash []byte
UpdateState string
UpdateTimestamp time.Time
}
type Swap struct {
ID int32
SwapHash []byte
Preimage []byte
InitiationTime time.Time
AmountRequested int64
CltvExpiry int32
MaxMinerFee int64
MaxSwapFee int64
InitiationHeight int32
ProtocolVersion int32
Label string
}
type SwapUpdate struct {
ID int32
SwapHash []byte
UpdateTimestamp time.Time
UpdateState int32
HtlcTxhash string
ServerCost int64
OnchainCost int64
OffchainCost int64
}
type Sweep struct {
ID int32
SwapHash []byte
BatchID int32
Outpoint string
Amt int64
Completed bool
}
type SweepBatch struct {
ID int32
Confirmed bool
BatchTxID sql.NullString
BatchPkScript []byte
LastRbfHeight sql.NullInt32
LastRbfSatPerKw sql.NullInt32
MaxTimeoutDistance int32
Cancelled bool
}
type SweepsOld struct {
ID int32
SwapHash []byte
BatchID int32
OutpointTxid []byte
OutpointIndex int32
Amt int64
Completed bool
}
type Withdrawal struct {
ID int32
WithdrawalID []byte
WithdrawalTxID sql.NullString
TotalDepositAmount int64
WithdrawnAmount sql.NullInt64
ChangeAmount sql.NullInt64
InitiationTime time.Time
ConfirmationHeight sql.NullInt64
}
type WithdrawalDeposit struct {
ID int32
WithdrawalID []byte
DepositID []byte
}