@@ -1053,7 +1053,9 @@ func TestKVPaymentsDBSwitchDoubleSend(t *testing.T) {
1053
1053
},
1054
1054
)
1055
1055
require .NoError (t , err , "error shouldn't have been received, got" )
1056
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusSucceeded )
1056
+ assertPaymentStatus (
1057
+ t , pControl , info .PaymentIdentifier , StatusSucceeded ,
1058
+ )
1057
1059
1058
1060
htlc .settle = & preimg
1059
1061
assertPaymentInfo (t , pControl , info .PaymentIdentifier , info , nil , htlc )
@@ -1164,7 +1166,9 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
1164
1166
if err != nil {
1165
1167
t .Fatalf ("unable to send htlc message: %v" , err )
1166
1168
}
1167
- _ , err = pControl .RegisterAttempt (info .PaymentIdentifier , attempt )
1169
+ _ , err = pControl .RegisterAttempt (
1170
+ info .PaymentIdentifier , attempt ,
1171
+ )
1168
1172
if err != nil {
1169
1173
t .Fatalf ("unable to send htlc message: %v" , err )
1170
1174
}
@@ -1188,13 +1192,18 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
1188
1192
1189
1193
// Fail the payment, which should moved it to Failed.
1190
1194
failReason := FailureReasonNoRoute
1191
- _ , err = pControl .Fail (info .PaymentIdentifier , failReason )
1195
+ _ , err = pControl .Fail (
1196
+ info .PaymentIdentifier , failReason ,
1197
+ )
1192
1198
if err != nil {
1193
1199
t .Fatalf ("unable to fail payment hash: %v" , err )
1194
1200
}
1195
1201
1196
1202
// Verify the status is indeed Failed.
1197
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusFailed )
1203
+ assertPaymentStatus (
1204
+ t , pControl , info .PaymentIdentifier ,
1205
+ StatusFailed ,
1206
+ )
1198
1207
1199
1208
htlc .failure = & htlcFailure
1200
1209
assertPaymentInfo (
@@ -1210,21 +1219,30 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
1210
1219
},
1211
1220
)
1212
1221
if err != nil {
1213
- t .Fatalf ("error shouldn't have been received, got: %v" , err )
1222
+ t .Fatalf ("error shouldn't have been " +
1223
+ "received, got: %v" , err )
1214
1224
}
1215
1225
1216
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusSucceeded )
1226
+ assertPaymentStatus (
1227
+ t , pControl , info .PaymentIdentifier ,
1228
+ StatusSucceeded ,
1229
+ )
1217
1230
1218
1231
htlc .settle = & preimg
1219
1232
assertPaymentInfo (
1220
- t , pControl , info .PaymentIdentifier , info , nil , htlc ,
1233
+ t , pControl , info .PaymentIdentifier , info , nil ,
1234
+ htlc ,
1221
1235
)
1222
1236
1223
1237
numSuccess ++
1224
1238
} else {
1225
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusInFlight )
1239
+ assertPaymentStatus (
1240
+ t , pControl , info .PaymentIdentifier ,
1241
+ StatusInFlight ,
1242
+ )
1226
1243
assertPaymentInfo (
1227
- t , pControl , info .PaymentIdentifier , info , nil , htlc ,
1244
+ t , pControl , info .PaymentIdentifier , info , nil ,
1245
+ htlc ,
1228
1246
)
1229
1247
1230
1248
numInflight ++
@@ -1438,7 +1456,8 @@ func TestKVPaymentsDBDeleteSinglePayment(t *testing.T) {
1438
1456
// Delete failed HTLC attempts for the third payment.
1439
1457
require .NoError (t , db .DeletePayment (payments [2 ].id , true ))
1440
1458
1441
- // Only the successful HTLC attempt should be left for the third payment.
1459
+ // Only the successful HTLC attempt should be left for the third
1460
+ // payment.
1442
1461
payments [2 ].htlcs = 1
1443
1462
assertPayments (t , db , payments [2 :])
1444
1463
@@ -1527,7 +1546,9 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1527
1546
a .AttemptID = i
1528
1547
attempts = append (attempts , & a )
1529
1548
1530
- _ , err = pControl .RegisterAttempt (info .PaymentIdentifier , & a )
1549
+ _ , err = pControl .RegisterAttempt (
1550
+ info .PaymentIdentifier , & a ,
1551
+ )
1531
1552
if err != nil {
1532
1553
t .Fatalf ("unable to send htlc message: %v" , err )
1533
1554
}
@@ -1540,7 +1561,8 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1540
1561
HTLCAttemptInfo : & a ,
1541
1562
}
1542
1563
assertPaymentInfo (
1543
- t , pControl , info .PaymentIdentifier , info , nil , htlc ,
1564
+ t , pControl , info .PaymentIdentifier , info , nil ,
1565
+ htlc ,
1544
1566
)
1545
1567
}
1546
1568
@@ -1574,7 +1596,9 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1574
1596
)
1575
1597
1576
1598
// Payment should still be in-flight.
1577
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusInFlight )
1599
+ assertPaymentStatus (
1600
+ t , pControl , info .PaymentIdentifier , StatusInFlight ,
1601
+ )
1578
1602
1579
1603
// Depending on the test case, settle or fail the first attempt.
1580
1604
a = attempts [0 ]
@@ -1598,7 +1622,8 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1598
1622
// Assert that the HTLC has had the preimage recorded.
1599
1623
htlc .settle = & preimg
1600
1624
assertPaymentInfo (
1601
- t , pControl , info .PaymentIdentifier , info , nil , htlc ,
1625
+ t , pControl , info .PaymentIdentifier , info , nil ,
1626
+ htlc ,
1602
1627
)
1603
1628
} else {
1604
1629
_ , err := pControl .FailAttempt (
@@ -1615,13 +1640,16 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1615
1640
// Assert the failure was recorded.
1616
1641
htlc .failure = & htlcFail
1617
1642
assertPaymentInfo (
1618
- t , pControl , info .PaymentIdentifier , info , nil , htlc ,
1643
+ t , pControl , info .PaymentIdentifier , info , nil ,
1644
+ htlc ,
1619
1645
)
1620
1646
1621
1647
// We also record a payment level fail, to move it into
1622
1648
// a terminal state.
1623
1649
failReason := FailureReasonNoRoute
1624
- _ , err = pControl .Fail (info .PaymentIdentifier , failReason )
1650
+ _ , err = pControl .Fail (
1651
+ info .PaymentIdentifier , failReason ,
1652
+ )
1625
1653
if err != nil {
1626
1654
t .Fatalf ("unable to fail payment hash: %v" , err )
1627
1655
}
@@ -1649,7 +1677,9 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1649
1677
require .ErrorIs (t , err , ErrPaymentPendingFailed )
1650
1678
}
1651
1679
1652
- assertPaymentStatus (t , pControl , info .PaymentIdentifier , StatusInFlight )
1680
+ assertPaymentStatus (
1681
+ t , pControl , info .PaymentIdentifier , StatusInFlight ,
1682
+ )
1653
1683
1654
1684
// Settle or fail the remaining attempt based on the testcase.
1655
1685
a = attempts [2 ]
@@ -1696,7 +1726,9 @@ func TestKVPaymentsDBMultiShard(t *testing.T) {
1696
1726
// write a terminal failure to the database without
1697
1727
// syncing.
1698
1728
failReason := FailureReasonPaymentDetails
1699
- _ , err = pControl .Fail (info .PaymentIdentifier , failReason )
1729
+ _ , err = pControl .Fail (
1730
+ info .PaymentIdentifier , failReason ,
1731
+ )
1700
1732
require .NoError (t , err , "unable to fail" )
1701
1733
}
1702
1734
@@ -1888,7 +1920,9 @@ func testDeleteFailedAttempts(t *testing.T, keepFailedPaymentAttempts bool) {
1888
1920
// Calling DeleteFailedAttempts on an in-flight payment should return
1889
1921
// an error.
1890
1922
if keepFailedPaymentAttempts {
1891
- require .NoError (t , pControl .DeleteFailedAttempts (payments [1 ].id ))
1923
+ require .NoError (
1924
+ t , pControl .DeleteFailedAttempts (payments [1 ].id ),
1925
+ )
1892
1926
} else {
1893
1927
require .Error (t , pControl .DeleteFailedAttempts (payments [1 ].id ))
1894
1928
}
@@ -1910,10 +1944,14 @@ func testDeleteFailedAttempts(t *testing.T, keepFailedPaymentAttempts bool) {
1910
1944
// DeleteFailedAttempts is ignored, even for non-existent
1911
1945
// payments, if the control tower is configured to keep failed
1912
1946
// HTLCs.
1913
- require .NoError (t , pControl .DeleteFailedAttempts (lntypes .ZeroHash ))
1947
+ require .NoError (
1948
+ t , pControl .DeleteFailedAttempts (lntypes .ZeroHash ),
1949
+ )
1914
1950
} else {
1915
1951
// Attempting to cleanup a non-existent payment returns an error.
1916
- require .Error (t , pControl .DeleteFailedAttempts (lntypes .ZeroHash ))
1952
+ require .Error (
1953
+ t , pControl .DeleteFailedAttempts (lntypes .ZeroHash ),
1954
+ )
1917
1955
}
1918
1956
}
1919
1957
@@ -2167,7 +2205,9 @@ func assertPayments(t *testing.T, db *DB, payments []*payment) {
2167
2205
2168
2206
// Make sure that the number of fetched payments is the same
2169
2207
// as expected.
2170
- require .Len (t , dbPayments , len (payments ), "unexpected number of payments" )
2208
+ require .Len (
2209
+ t , dbPayments , len (payments ), "unexpected number of payments" ,
2210
+ )
2171
2211
2172
2212
// Convert fetched payments of type MPPayment to our helper structure.
2173
2213
p := make ([]* payment , len (dbPayments ))
0 commit comments