@@ -113,7 +113,7 @@ func (h *mockPresignedHelper) DestPkScript(ctx context.Context,
113
113
}
114
114
115
115
// SignTx tries to sign the transaction. If all the inputs are online, it signs
116
- // the exact transaction passed and adds it to presignedBatches. Otherwise it
116
+ // the exact transaction passed and adds it to presignedBatches. Otherwise, it
117
117
// looks for a transaction in presignedBatches satisfying the criteria.
118
118
func (h * mockPresignedHelper ) SignTx (ctx context.Context ,
119
119
primarySweepID wire.OutPoint , tx * wire.MsgTx , inputAmt btcutil.Amount ,
@@ -273,7 +273,7 @@ func testPresigned_forgotten_presign(t *testing.T,
273
273
presignedHelper .SetOutpointOnline (op1 , false )
274
274
err := batcher .PresignSweepsGroup (
275
275
ctx , []Input {{Outpoint : op1 , Value : 1_000_000 }},
276
- sweepTimeout , destAddr ,
276
+ sweepTimeout , destAddr , nil ,
277
277
)
278
278
require .Error (t , err )
279
279
require .ErrorContains (t , err , "offline" )
@@ -350,7 +350,7 @@ func testPresigned_input1_offline_then_input2(t *testing.T,
350
350
presignedHelper .SetOutpointOnline (op1 , true )
351
351
err = batcher .PresignSweepsGroup (
352
352
ctx , []Input {{Outpoint : op1 , Value : 1_000_000 }},
353
- sweepTimeout , destAddr ,
353
+ sweepTimeout , destAddr , nil ,
354
354
)
355
355
require .NoError (t , err )
356
356
@@ -413,7 +413,7 @@ func testPresigned_input1_offline_then_input2(t *testing.T,
413
413
presignedHelper .SetOutpointOnline (op2 , true )
414
414
err = batcher .PresignSweepsGroup (
415
415
ctx , []Input {{Outpoint : op2 , Value : 2_000_000 }},
416
- sweepTimeout , destAddr ,
416
+ sweepTimeout , destAddr , nil ,
417
417
)
418
418
require .NoError (t , err )
419
419
@@ -520,7 +520,7 @@ func testPresigned_min_relay_fee(t *testing.T,
520
520
presignedHelper .SetOutpointOnline (op1 , true )
521
521
err := batcher .PresignSweepsGroup (
522
522
ctx , []Input {{Outpoint : op1 , Value : inputAmt }},
523
- sweepTimeout , destAddr ,
523
+ sweepTimeout , destAddr , nil ,
524
524
)
525
525
require .NoError (t , err )
526
526
@@ -644,7 +644,7 @@ func testPresigned_two_inputs_one_goes_offline(t *testing.T,
644
644
presignedHelper .SetOutpointOnline (op1 , true )
645
645
err = batcher .PresignSweepsGroup (
646
646
ctx , []Input {{Outpoint : op1 , Value : 1_000_000 }},
647
- sweepTimeout , destAddr ,
647
+ sweepTimeout , destAddr , nil ,
648
648
)
649
649
require .NoError (t , err )
650
650
require .NoError (t , batcher .AddSweep (ctx , & sweepReq1 ))
@@ -670,7 +670,7 @@ func testPresigned_two_inputs_one_goes_offline(t *testing.T,
670
670
presignedHelper .SetOutpointOnline (op2 , true )
671
671
err = batcher .PresignSweepsGroup (
672
672
ctx , []Input {{Outpoint : op2 , Value : 2_000_000 }},
673
- sweepTimeout , destAddr ,
673
+ sweepTimeout , destAddr , nil ,
674
674
)
675
675
require .NoError (t , err )
676
676
require .NoError (t , batcher .AddSweep (ctx , & sweepReq2 ))
@@ -780,7 +780,7 @@ func testPresigned_first_publish_fails(t *testing.T,
780
780
presignedHelper .SetOutpointOnline (op1 , true )
781
781
err = batcher .PresignSweepsGroup (
782
782
ctx , []Input {{Outpoint : op1 , Value : 1_000_000 }},
783
- sweepTimeout , destAddr ,
783
+ sweepTimeout , destAddr , nil ,
784
784
)
785
785
require .NoError (t , err )
786
786
presignedHelper .SetOutpointOnline (op1 , false )
@@ -903,7 +903,7 @@ func testPresigned_locktime(t *testing.T,
903
903
presignedHelper .SetOutpointOnline (op1 , true )
904
904
err = batcher .PresignSweepsGroup (
905
905
ctx , []Input {{Outpoint : op1 , Value : 1_000_000 }},
906
- sweepTimeout , destAddr ,
906
+ sweepTimeout , destAddr , nil ,
907
907
)
908
908
require .NoError (t , err )
909
909
presignedHelper .SetOutpointOnline (op1 , false )
@@ -994,14 +994,18 @@ func testPresigned_presigned_group(t *testing.T,
994
994
presignedHelper .SetOutpointOnline (op2 , false )
995
995
996
996
// An attempt to presign must fail.
997
- err = batcher .PresignSweepsGroup (ctx , group1 , sweepTimeout , destAddr )
997
+ err = batcher .PresignSweepsGroup (
998
+ ctx , group1 , sweepTimeout , destAddr , nil ,
999
+ )
998
1000
require .ErrorContains (t , err , "some outpoint is offline" )
999
1001
1000
1002
// Enable both outpoints.
1001
1003
presignedHelper .SetOutpointOnline (op2 , true )
1002
1004
1003
1005
// An attempt to presign must succeed.
1004
- err = batcher .PresignSweepsGroup (ctx , group1 , sweepTimeout , destAddr )
1006
+ err = batcher .PresignSweepsGroup (
1007
+ ctx , group1 , sweepTimeout , destAddr , nil ,
1008
+ )
1005
1009
require .NoError (t , err )
1006
1010
1007
1011
// Add the sweep, triggering the publish attempt.
@@ -1053,7 +1057,9 @@ func testPresigned_presigned_group(t *testing.T,
1053
1057
presignedHelper .SetOutpointOnline (op4 , true )
1054
1058
1055
1059
// An attempt to presign must succeed.
1056
- err = batcher .PresignSweepsGroup (ctx , group2 , sweepTimeout , destAddr )
1060
+ err = batcher .PresignSweepsGroup (
1061
+ ctx , group2 , sweepTimeout , destAddr , nil ,
1062
+ )
1057
1063
require .NoError (t , err )
1058
1064
1059
1065
// Add the sweep. It should go to the same batch.
@@ -1107,7 +1113,9 @@ func testPresigned_presigned_group(t *testing.T,
1107
1113
presignedHelper .SetOutpointOnline (op6 , true )
1108
1114
1109
1115
// An attempt to presign must succeed.
1110
- err = batcher .PresignSweepsGroup (ctx , group3 , sweepTimeout , destAddr )
1116
+ err = batcher .PresignSweepsGroup (
1117
+ ctx , group3 , sweepTimeout , destAddr , nil ,
1118
+ )
1111
1119
require .NoError (t , err )
1112
1120
1113
1121
// Add the sweep. It should go to the same batch.
@@ -1215,9 +1223,9 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1215
1223
1216
1224
setFeeRate (feeRateLow )
1217
1225
1218
- /////////////////////////////////////
1226
+ // ///////////////////////////////////
1219
1227
// Create the first regular sweep. //
1220
- /////////////////////////////////////
1228
+ // ///////////////////////////////////
1221
1229
swapHash1 := lntypes.Hash {1 , 1 , 1 }
1222
1230
op1 := wire.OutPoint {
1223
1231
Hash : chainhash.Hash {1 , 1 },
@@ -1264,9 +1272,9 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1264
1272
require .Len (t , tx1 .TxIn , 1 )
1265
1273
require .Len (t , tx1 .TxOut , 1 )
1266
1274
1267
- ///////////////////////////////////////
1275
+ // /////////////////////////////////////
1268
1276
// Create the first presigned sweep. //
1269
- ///////////////////////////////////////
1277
+ // /////////////////////////////////////
1270
1278
swapHash2 := lntypes.Hash {2 , 2 , 2 }
1271
1279
op2 := wire.OutPoint {
1272
1280
Hash : chainhash.Hash {2 , 2 },
@@ -1304,7 +1312,7 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1304
1312
presignedHelper .SetOutpointOnline (op2 , true )
1305
1313
err = batcher .PresignSweepsGroup (
1306
1314
ctx , []Input {{Outpoint : op2 , Value : 2_000_000 }},
1307
- sweepTimeout , destAddr ,
1315
+ sweepTimeout , destAddr , nil ,
1308
1316
)
1309
1317
require .NoError (t , err )
1310
1318
require .NoError (t , batcher .AddSweep (ctx , & sweepReq2 ))
@@ -1319,9 +1327,9 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1319
1327
require .Len (t , tx2 .TxOut , 1 )
1320
1328
require .Equal (t , op2 , tx2 .TxIn [0 ].PreviousOutPoint )
1321
1329
1322
- //////////////////////////////////////
1330
+ // ////////////////////////////////////
1323
1331
// Create the second regular sweep. //
1324
- //////////////////////////////////////
1332
+ // ////////////////////////////////////
1325
1333
swapHash3 := lntypes.Hash {3 , 3 , 3 }
1326
1334
op3 := wire.OutPoint {
1327
1335
Hash : chainhash.Hash {3 , 3 },
@@ -1359,9 +1367,9 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1359
1367
// Deliver sweep request to batcher.
1360
1368
require .NoError (t , batcher .AddSweep (ctx , & sweepReq3 ))
1361
1369
1362
- ////////////////////////////////////////
1370
+ // //////////////////////////////////////
1363
1371
// Create the second presigned sweep. //
1364
- ////////////////////////////////////////
1372
+ // //////////////////////////////////////
1365
1373
swapHash4 := lntypes.Hash {4 , 4 , 4 }
1366
1374
op4 := wire.OutPoint {
1367
1375
Hash : chainhash.Hash {4 , 4 },
@@ -1399,7 +1407,7 @@ func testPresigned_presigned_and_regular_sweeps(t *testing.T, store testStore,
1399
1407
presignedHelper .SetOutpointOnline (op4 , true )
1400
1408
err = batcher .PresignSweepsGroup (
1401
1409
ctx , []Input {{Outpoint : op4 , Value : 3_000_000 }},
1402
- sweepTimeout , destAddr ,
1410
+ sweepTimeout , destAddr , nil ,
1403
1411
)
1404
1412
require .NoError (t , err )
1405
1413
require .NoError (t , batcher .AddSweep (ctx , & sweepReq4 ))
@@ -1520,7 +1528,7 @@ func testPresigned_purging(t *testing.T, numSwaps, numConfirmedSwaps int,
1520
1528
1521
1529
// An attempt to presign must succeed.
1522
1530
err := batcher .PresignSweepsGroup (
1523
- ctx , group , sweepTimeout , destAddr ,
1531
+ ctx , group , sweepTimeout , destAddr , nil ,
1524
1532
)
1525
1533
require .NoError (t , err )
1526
1534
@@ -1584,11 +1592,11 @@ func testPresigned_purging(t *testing.T, numSwaps, numConfirmedSwaps int,
1584
1592
1585
1593
// An attempt to presign must succeed.
1586
1594
err := batcher .PresignSweepsGroup (
1587
- ctx , group , sweepTimeout , destAddr ,
1595
+ ctx , group , sweepTimeout , destAddr , nil ,
1588
1596
)
1589
1597
require .NoError (t , err )
1590
1598
1591
- // Add the sweep, triggering the publish attempt.
1599
+ // Add the sweep, triggering the publishing attempt.
1592
1600
require .NoError (t , batcher .AddSweep (ctx , & SweepRequest {
1593
1601
SwapHash : swapHash ,
1594
1602
Inputs : group ,
0 commit comments