Skip to content

Commit 37194d3

Browse files
authored
Merge pull request #761 from starius/sweepbatcher-load-swaps-from-loopdb-only
sweepbatcher/Store: use only own tables (separating from loopdb)
2 parents 6b09aaa + 7a7ea05 commit 37194d3

File tree

13 files changed

+62
-208
lines changed

13 files changed

+62
-208
lines changed

loopdb/sqlc/batch.sql.go

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

loopdb/sqlc/instantout.sql.go

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

loopdb/sqlc/querier.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

loopdb/sqlc/queries/batch.sql

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ WHERE
7676
sweeps.swap_hash = $1
7777
AND
7878
sweeps.completed = TRUE
79-
AND
79+
AND
8080
sweep_batches.confirmed = TRUE;
8181

8282
-- name: GetBatchSweptAmount :one
@@ -91,22 +91,13 @@ AND
9191

9292
-- name: GetBatchSweeps :many
9393
SELECT
94-
sweeps.*,
95-
swaps.*,
96-
loopout_swaps.*,
97-
htlc_keys.*
94+
*
9895
FROM
9996
sweeps
100-
JOIN
101-
swaps ON sweeps.swap_hash = swaps.swap_hash
102-
JOIN
103-
loopout_swaps ON sweeps.swap_hash = loopout_swaps.swap_hash
104-
JOIN
105-
htlc_keys ON sweeps.swap_hash = htlc_keys.swap_hash
10697
WHERE
107-
sweeps.batch_id = $1
98+
batch_id = $1
10899
ORDER BY
109-
sweeps.id ASC;
100+
id ASC;
110101

111102
-- name: GetSweepStatus :one
112103
SELECT

loopdb/sqlc/queries/instantout.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- name: InsertInstantOut :exec
22
INSERT INTO instantout_swaps (
33
swap_hash,
4-
preimage,
4+
preimage,
55
sweep_address,
66
outgoing_chan_set,
77
htlc_fee_rate,
@@ -53,7 +53,7 @@ WHERE
5353
swaps.swap_hash = $1;
5454

5555
-- name: GetInstantOutSwaps :many
56-
SELECT
56+
SELECT
5757
swaps.*,
5858
instantout_swaps.*,
5959
htlc_keys.*

loopdb/sqlc/queries/swaps.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-- name: GetLoopOutSwaps :many
2-
SELECT
2+
SELECT
33
swaps.*,
44
loopout_swaps.*,
55
htlc_keys.*
6-
FROM
6+
FROM
77
swaps
88
JOIN
99
loopout_swaps ON swaps.swap_hash = loopout_swaps.swap_hash
@@ -13,7 +13,7 @@ ORDER BY
1313
swaps.id;
1414

1515
-- name: GetLoopOutSwap :one
16-
SELECT
16+
SELECT
1717
swaps.*,
1818
loopout_swaps.*,
1919
htlc_keys.*
@@ -27,7 +27,7 @@ WHERE
2727
swaps.swap_hash = $1;
2828

2929
-- name: GetLoopInSwaps :many
30-
SELECT
30+
SELECT
3131
swaps.*,
3232
loopin_swaps.*,
3333
htlc_keys.*
@@ -41,7 +41,7 @@ ORDER BY
4141
swaps.id;
4242

4343
-- name: GetLoopInSwap :one
44-
SELECT
44+
SELECT
4545
swaps.*,
4646
loopin_swaps.*,
4747
htlc_keys.*
@@ -55,7 +55,7 @@ WHERE
5555
swaps.swap_hash = $1;
5656

5757
-- name: GetSwapUpdates :many
58-
SELECT
58+
SELECT
5959
*
6060
FROM
6161
swap_updates

loopdb/sqlc/swaps.sql.go

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

loopout_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func testCustomSweepConfTarget(t *testing.T) {
297297

298298
errChan := make(chan error, 2)
299299

300-
batcherStore := sweepbatcher.NewStoreMock(cfg.store)
300+
batcherStore := sweepbatcher.NewStoreMock()
301301

302302
batcher := sweepbatcher.NewBatcher(
303303
lnd.WalletKit, lnd.ChainNotifier, lnd.Signer,
@@ -530,7 +530,7 @@ func testPreimagePush(t *testing.T) {
530530

531531
errChan := make(chan error, 2)
532532

533-
batcherStore := sweepbatcher.NewStoreMock(cfg.store)
533+
batcherStore := sweepbatcher.NewStoreMock()
534534

535535
batcher := sweepbatcher.NewBatcher(
536536
lnd.WalletKit, lnd.ChainNotifier, lnd.Signer,
@@ -951,7 +951,7 @@ func TestLoopOutMuSig2Sweep(t *testing.T) {
951951

952952
errChan := make(chan error, 2)
953953

954-
batcherStore := sweepbatcher.NewStoreMock(cfg.store)
954+
batcherStore := sweepbatcher.NewStoreMock()
955955

956956
batcher := sweepbatcher.NewBatcher(
957957
lnd.WalletKit, lnd.ChainNotifier, lnd.Signer,

0 commit comments

Comments
 (0)