Skip to content

Commit 63c638b

Browse files
committed
loopdb: add asset params to store
1 parent c83ea88 commit 63c638b

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

loopdb/sql_store.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ func loopOutToInsertArgs(hash lntypes.Hash,
499499
MaxPrepayRoutingFee: int64(loopOut.MaxPrepayRoutingFee),
500500
PublicationDeadline: loopOut.SwapPublicationDeadline.UTC(),
501501
PaymentTimeout: int32(loopOut.PaymentTimeout.Seconds()),
502+
AssetID: loopOut.AssetId,
503+
AssetEdgeNode: loopOut.AssetEdgeNode,
502504
}
503505
}
504506

@@ -595,6 +597,8 @@ func ConvertLoopOutRow(network *chaincfg.Params, row sqlc.GetLoopOutSwapRow,
595597
PaymentTimeout: time.Duration(
596598
row.PaymentTimeout,
597599
) * time.Second,
600+
AssetId: row.AssetID,
601+
AssetEdgeNode: row.AssetEdgeNode,
598602
},
599603
Loop: Loop{
600604
Hash: swapHash,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- asset_id is an optional field that can be used to specify the asset id that
2+
-- will be used to pay the swap invoice using a taproot assets channel.
3+
ALTER TABLE loopout_swaps ADD asset_id BYTEA;
4+
5+
-- asset_edge_node is an optional field that can be used to specify the node
6+
-- that will be used to route the asset payment through.
7+
ALTER TABLE loopout_swaps ADD asset_edge_node BYTEA;

loopdb/sqlc/models.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

loopdb/sqlc/queries/swaps.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ INSERT INTO loopout_swaps (
106106
max_prepay_routing_fee,
107107
publication_deadline,
108108
single_sweep,
109-
payment_timeout
109+
payment_timeout,
110+
asset_id,
111+
asset_edge_node
110112
) VALUES (
111-
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12
113+
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14
112114
);
113115

114116
-- name: InsertLoopIn :exec

loopdb/sqlc/swaps.sql.go

Lines changed: 18 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)