mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
sqlc: add amount column to static swaps
This commit is contained in:
parent
1a4f16fc20
commit
22ac716726
5 changed files with 22 additions and 4 deletions
|
|
@ -0,0 +1,3 @@
|
|||
-- selected_amount is a fractional amount amongst selected deposits of a static
|
||||
-- address loop-in swap.
|
||||
ALTER TABLE static_address_swaps DROP COLUMN selected_amount;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
-- selected_amount is a fractional amount amongst selected deposits of a static
|
||||
-- address loop-in swap. A selected amount of 0 indicates that the total amount
|
||||
-- of deposits is selected for the swap.
|
||||
ALTER TABLE static_address_swaps ADD selected_amount BIGINT NOT NULL DEFAULT 0;
|
||||
|
|
@ -147,6 +147,7 @@ type StaticAddressSwap struct {
|
|||
HtlcTxFeeRateSatKw int64
|
||||
HtlcTimeoutSweepTxID sql.NullString
|
||||
HtlcTimeoutSweepAddress string
|
||||
SelectedAmount int64
|
||||
}
|
||||
|
||||
type StaticAddressSwapUpdate struct {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ INSERT INTO static_address_swaps (
|
|||
payment_timeout_seconds,
|
||||
quoted_swap_fee_satoshis,
|
||||
deposit_outpoints,
|
||||
selected_amount,
|
||||
htlc_tx_fee_rate_sat_kw,
|
||||
htlc_timeout_sweep_tx_id,
|
||||
htlc_timeout_sweep_address
|
||||
|
|
@ -18,7 +19,8 @@ INSERT INTO static_address_swaps (
|
|||
$6,
|
||||
$7,
|
||||
$8,
|
||||
$9
|
||||
$9,
|
||||
$10
|
||||
);
|
||||
|
||||
-- name: UpdateStaticAddressLoopIn :exec
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ func (q *Queries) GetLoopInSwapUpdates(ctx context.Context, swapHash []byte) ([]
|
|||
const getStaticAddressLoopInSwap = `-- name: GetStaticAddressLoopInSwap :one
|
||||
SELECT
|
||||
swaps.id, swaps.swap_hash, swaps.preimage, swaps.initiation_time, swaps.amount_requested, swaps.cltv_expiry, swaps.max_miner_fee, swaps.max_swap_fee, swaps.initiation_height, swaps.protocol_version, swaps.label,
|
||||
static_address_swaps.id, static_address_swaps.swap_hash, static_address_swaps.swap_invoice, static_address_swaps.last_hop, static_address_swaps.payment_timeout_seconds, static_address_swaps.quoted_swap_fee_satoshis, static_address_swaps.deposit_outpoints, static_address_swaps.htlc_tx_fee_rate_sat_kw, static_address_swaps.htlc_timeout_sweep_tx_id, static_address_swaps.htlc_timeout_sweep_address,
|
||||
static_address_swaps.id, static_address_swaps.swap_hash, static_address_swaps.swap_invoice, static_address_swaps.last_hop, static_address_swaps.payment_timeout_seconds, static_address_swaps.quoted_swap_fee_satoshis, static_address_swaps.deposit_outpoints, static_address_swaps.htlc_tx_fee_rate_sat_kw, static_address_swaps.htlc_timeout_sweep_tx_id, static_address_swaps.htlc_timeout_sweep_address, static_address_swaps.selected_amount,
|
||||
htlc_keys.swap_hash, htlc_keys.sender_script_pubkey, htlc_keys.receiver_script_pubkey, htlc_keys.sender_internal_pubkey, htlc_keys.receiver_internal_pubkey, htlc_keys.client_key_family, htlc_keys.client_key_index
|
||||
FROM
|
||||
swaps
|
||||
|
|
@ -187,6 +187,7 @@ type GetStaticAddressLoopInSwapRow struct {
|
|||
HtlcTxFeeRateSatKw int64
|
||||
HtlcTimeoutSweepTxID sql.NullString
|
||||
HtlcTimeoutSweepAddress string
|
||||
SelectedAmount int64
|
||||
SwapHash_3 []byte
|
||||
SenderScriptPubkey []byte
|
||||
ReceiverScriptPubkey []byte
|
||||
|
|
@ -221,6 +222,7 @@ func (q *Queries) GetStaticAddressLoopInSwap(ctx context.Context, swapHash []byt
|
|||
&i.HtlcTxFeeRateSatKw,
|
||||
&i.HtlcTimeoutSweepTxID,
|
||||
&i.HtlcTimeoutSweepAddress,
|
||||
&i.SelectedAmount,
|
||||
&i.SwapHash_3,
|
||||
&i.SenderScriptPubkey,
|
||||
&i.ReceiverScriptPubkey,
|
||||
|
|
@ -235,7 +237,7 @@ func (q *Queries) GetStaticAddressLoopInSwap(ctx context.Context, swapHash []byt
|
|||
const getStaticAddressLoopInSwapsByStates = `-- name: GetStaticAddressLoopInSwapsByStates :many
|
||||
SELECT
|
||||
swaps.id, swaps.swap_hash, swaps.preimage, swaps.initiation_time, swaps.amount_requested, swaps.cltv_expiry, swaps.max_miner_fee, swaps.max_swap_fee, swaps.initiation_height, swaps.protocol_version, swaps.label,
|
||||
static_address_swaps.id, static_address_swaps.swap_hash, static_address_swaps.swap_invoice, static_address_swaps.last_hop, static_address_swaps.payment_timeout_seconds, static_address_swaps.quoted_swap_fee_satoshis, static_address_swaps.deposit_outpoints, static_address_swaps.htlc_tx_fee_rate_sat_kw, static_address_swaps.htlc_timeout_sweep_tx_id, static_address_swaps.htlc_timeout_sweep_address,
|
||||
static_address_swaps.id, static_address_swaps.swap_hash, static_address_swaps.swap_invoice, static_address_swaps.last_hop, static_address_swaps.payment_timeout_seconds, static_address_swaps.quoted_swap_fee_satoshis, static_address_swaps.deposit_outpoints, static_address_swaps.htlc_tx_fee_rate_sat_kw, static_address_swaps.htlc_timeout_sweep_tx_id, static_address_swaps.htlc_timeout_sweep_address, static_address_swaps.selected_amount,
|
||||
htlc_keys.swap_hash, htlc_keys.sender_script_pubkey, htlc_keys.receiver_script_pubkey, htlc_keys.sender_internal_pubkey, htlc_keys.receiver_internal_pubkey, htlc_keys.client_key_family, htlc_keys.client_key_index
|
||||
FROM
|
||||
swaps
|
||||
|
|
@ -280,6 +282,7 @@ type GetStaticAddressLoopInSwapsByStatesRow struct {
|
|||
HtlcTxFeeRateSatKw int64
|
||||
HtlcTimeoutSweepTxID sql.NullString
|
||||
HtlcTimeoutSweepAddress string
|
||||
SelectedAmount int64
|
||||
SwapHash_3 []byte
|
||||
SenderScriptPubkey []byte
|
||||
ReceiverScriptPubkey []byte
|
||||
|
|
@ -320,6 +323,7 @@ func (q *Queries) GetStaticAddressLoopInSwapsByStates(ctx context.Context, dolla
|
|||
&i.HtlcTxFeeRateSatKw,
|
||||
&i.HtlcTimeoutSweepTxID,
|
||||
&i.HtlcTimeoutSweepAddress,
|
||||
&i.SelectedAmount,
|
||||
&i.SwapHash_3,
|
||||
&i.SenderScriptPubkey,
|
||||
&i.ReceiverScriptPubkey,
|
||||
|
|
@ -349,6 +353,7 @@ INSERT INTO static_address_swaps (
|
|||
payment_timeout_seconds,
|
||||
quoted_swap_fee_satoshis,
|
||||
deposit_outpoints,
|
||||
selected_amount,
|
||||
htlc_tx_fee_rate_sat_kw,
|
||||
htlc_timeout_sweep_tx_id,
|
||||
htlc_timeout_sweep_address
|
||||
|
|
@ -361,7 +366,8 @@ INSERT INTO static_address_swaps (
|
|||
$6,
|
||||
$7,
|
||||
$8,
|
||||
$9
|
||||
$9,
|
||||
$10
|
||||
)
|
||||
`
|
||||
|
||||
|
|
@ -372,6 +378,7 @@ type InsertStaticAddressLoopInParams struct {
|
|||
PaymentTimeoutSeconds int32
|
||||
QuotedSwapFeeSatoshis int64
|
||||
DepositOutpoints string
|
||||
SelectedAmount int64
|
||||
HtlcTxFeeRateSatKw int64
|
||||
HtlcTimeoutSweepTxID sql.NullString
|
||||
HtlcTimeoutSweepAddress string
|
||||
|
|
@ -385,6 +392,7 @@ func (q *Queries) InsertStaticAddressLoopIn(ctx context.Context, arg InsertStati
|
|||
arg.PaymentTimeoutSeconds,
|
||||
arg.QuotedSwapFeeSatoshis,
|
||||
arg.DepositOutpoints,
|
||||
arg.SelectedAmount,
|
||||
arg.HtlcTxFeeRateSatKw,
|
||||
arg.HtlcTimeoutSweepTxID,
|
||||
arg.HtlcTimeoutSweepAddress,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue