@@ -1354,7 +1354,7 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1354
1354
// to another online batch. In offline case they must are added to a new batch
1355
1355
// having valid presigned transactions.
1356
1356
func testPresigned_purging (t * testing.T , numSwaps , numConfirmedSwaps int ,
1357
- store testStore , batcherStore testBatcherStore , online bool ) {
1357
+ batcherStore testBatcherStore , online bool ) {
1358
1358
1359
1359
defer test .Guard (t )()
1360
1360
@@ -1420,33 +1420,13 @@ func testPresigned_purging(t *testing.T, numSwaps, numConfirmedSwaps int,
1420
1420
}
1421
1421
groups [i ] = group
1422
1422
1423
- // Create a swap in DB.
1424
- swap := & loopdb.LoopOutContract {
1425
- SwapContract : loopdb.SwapContract {
1426
- CltvExpiry : 111 ,
1427
- AmountRequested : swapAmount ,
1428
- ProtocolVersion : loopdb .ProtocolVersionMuSig2 ,
1429
- HtlcKeys : htlcKeys ,
1430
-
1431
- // Make preimage unique to pass SQL constraints.
1432
- Preimage : lntypes.Preimage {byte (i + 1 )},
1433
- },
1434
-
1435
- DestAddr : destAddr ,
1436
- SwapInvoice : swapInvoice ,
1437
- SweepConfTarget : 111 ,
1438
- }
1439
- err := store .CreateLoopOut (ctx , swapHash , swap )
1440
- require .NoError (t , err )
1441
- store .AssertLoopOutStored ()
1442
-
1443
1423
// Enable all the sweeps.
1444
1424
for _ , op := range ops {
1445
1425
presignedHelper .SetOutpointOnline (op , true )
1446
1426
}
1447
1427
1448
1428
// An attempt to presign must succeed.
1449
- err = batcher .PresignSweepsGroup (
1429
+ err : = batcher .PresignSweepsGroup (
1450
1430
ctx , group , sweepTimeout , destAddr ,
1451
1431
)
1452
1432
require .NoError (t , err )
@@ -1506,31 +1486,11 @@ func testPresigned_purging(t *testing.T, numSwaps, numConfirmedSwaps int,
1506
1486
},
1507
1487
}
1508
1488
1509
- // Create a swap in DB.
1510
- swap := & loopdb.LoopOutContract {
1511
- SwapContract : loopdb.SwapContract {
1512
- CltvExpiry : 111 ,
1513
- AmountRequested : amount ,
1514
- ProtocolVersion : loopdb .ProtocolVersionMuSig2 ,
1515
- HtlcKeys : htlcKeys ,
1516
-
1517
- // Make preimage unique to pass SQL constraints.
1518
- Preimage : lntypes.Preimage {1 , 2 , 3 },
1519
- },
1520
-
1521
- DestAddr : destAddr ,
1522
- SwapInvoice : swapInvoice ,
1523
- SweepConfTarget : 111 ,
1524
- }
1525
- err := store .CreateLoopOut (ctx , swapHash , swap )
1526
- require .NoError (t , err )
1527
- store .AssertLoopOutStored ()
1528
-
1529
1489
// Enable the sweep.
1530
1490
presignedHelper .SetOutpointOnline (opx , true )
1531
1491
1532
1492
// An attempt to presign must succeed.
1533
- err = batcher .PresignSweepsGroup (
1493
+ err : = batcher .PresignSweepsGroup (
1534
1494
ctx , group , sweepTimeout , destAddr ,
1535
1495
)
1536
1496
require .NoError (t , err )
@@ -1759,14 +1719,10 @@ func TestPresigned(t *testing.T) {
1759
1719
}
1760
1720
1761
1721
t .Run (name , func (t * testing.T ) {
1762
- runTests (t , func (t * testing.T , store testStore ,
1763
- batcherStore testBatcherStore ) {
1764
-
1765
- testPresigned_purging (
1766
- t , numSwaps , numConfirmedSwaps ,
1767
- store , batcherStore , online ,
1768
- )
1769
- })
1722
+ testPresigned_purging (
1723
+ t , numSwaps , numConfirmedSwaps ,
1724
+ NewStoreMock (), online ,
1725
+ )
1770
1726
})
1771
1727
}
1772
1728
0 commit comments