@@ -320,11 +320,18 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
320
320
}
321
321
ht .SendPaymentAssertInflight (alice , req )
322
322
323
- // Verify that all nodes in the path now have two HTLC's with the
324
- // proper parameters.
325
- ht .AssertActiveHtlcs (alice , dustPayHash , payHash )
326
- ht .AssertActiveHtlcs (bob , dustPayHash , payHash )
327
- ht .AssertActiveHtlcs (carol , dustPayHash , payHash )
323
+ // At this point, all 3 nodes should now have an active channel with
324
+ // the created HTLC pending on all of them.
325
+ //
326
+ // Alice should have two outgoing HTLCs on channel Alice -> Bob.
327
+ ht .AssertNumActiveHtlcs (alice , 2 )
328
+
329
+ // Bob should have two incoming HTLCs on channel Alice -> Bob, and two
330
+ // outgoing HTLCs on channel Bob -> Carol.
331
+ ht .AssertNumActiveHtlcs (bob , 4 )
332
+
333
+ // Carol should have two incoming HTLCs on channel Bob -> Carol.
334
+ ht .AssertNumActiveHtlcs (carol , 2 )
328
335
329
336
// We'll now mine enough blocks to trigger Bob's force close the
330
337
// channel Bob=>Carol due to the fact that the HTLC is about to
@@ -364,7 +371,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
364
371
// At this point, Bob should have canceled backwards the dust HTLC that
365
372
// we sent earlier. This means Alice should now only have a single HTLC
366
373
// on her channel.
367
- ht .AssertActiveHtlcs (alice , payHash )
374
+ ht .AssertNumActiveHtlcs (alice , 1 )
368
375
369
376
// With the closing transaction confirmed, we should expect Bob's HTLC
370
377
// timeout transaction to be offered to the sweeper due to the expiry
@@ -651,9 +658,18 @@ func runMultiHopReceiverPreimageClaim(ht *lntest.HarnessTest,
651
658
652
659
// At this point, all 3 nodes should now have an active channel with
653
660
// the created HTLC pending on all of them.
654
- ht .AssertActiveHtlcs (alice , payHash [:])
655
- ht .AssertActiveHtlcs (bob , payHash [:])
656
- ht .AssertActiveHtlcs (carol , payHash [:])
661
+ // At this point, all 3 nodes should now have an active channel with
662
+ // the created HTLCs pending on all of them.
663
+ //
664
+ // Alice should have one outgoing HTLCs on channel Alice -> Bob.
665
+ ht .AssertNumActiveHtlcs (alice , 1 )
666
+
667
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
668
+ // outgoing HTLC on channel Bob -> Carol.
669
+ ht .AssertNumActiveHtlcs (bob , 2 )
670
+
671
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
672
+ ht .AssertNumActiveHtlcs (carol , 1 )
657
673
658
674
// Wait for Carol to mark invoice as accepted. There is a small gap to
659
675
// bridge between adding the htlc to the channel and executing the exit
@@ -1010,11 +1026,20 @@ func runLocalForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
1010
1026
}
1011
1027
ht .SendPaymentAssertInflight (alice , req )
1012
1028
1013
- // Once the HTLC has cleared, all channels in our mini network should
1014
- // have the it locked in.
1015
- ht .AssertActiveHtlcs (alice , payHash )
1016
- ht .AssertActiveHtlcs (bob , payHash )
1017
- ht .AssertActiveHtlcs (carol , payHash )
1029
+ // At this point, all 3 nodes should now have an active channel with
1030
+ // the created HTLC pending on all of them.
1031
+ // At this point, all 3 nodes should now have an active channel with
1032
+ // the created HTLCs pending on all of them.
1033
+ //
1034
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1035
+ ht .AssertNumActiveHtlcs (alice , 1 )
1036
+
1037
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1038
+ // outgoing HTLC on channel Bob -> Carol.
1039
+ ht .AssertNumActiveHtlcs (bob , 2 )
1040
+
1041
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1042
+ ht .AssertNumActiveHtlcs (carol , 1 )
1018
1043
1019
1044
// Now that all parties have the HTLC locked in, we'll immediately
1020
1045
// force close the Bob -> Carol channel. This should trigger contract
@@ -1339,11 +1364,18 @@ func runRemoteForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
1339
1364
}
1340
1365
ht .SendPaymentAssertInflight (alice , req )
1341
1366
1342
- // Once the HTLC has cleared, all the nodes in our mini network should
1343
- // show that the HTLC has been locked in.
1344
- ht .AssertActiveHtlcs (alice , payHash [:])
1345
- ht .AssertActiveHtlcs (bob , payHash [:])
1346
- ht .AssertActiveHtlcs (carol , payHash [:])
1367
+ // At this point, all 3 nodes should now have an active channel with
1368
+ // the created HTLCs pending on all of them.
1369
+ //
1370
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1371
+ ht .AssertNumActiveHtlcs (alice , 1 )
1372
+
1373
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1374
+ // outgoing HTLC on channel Bob -> Carol.
1375
+ ht .AssertNumActiveHtlcs (bob , 2 )
1376
+
1377
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1378
+ ht .AssertNumActiveHtlcs (carol , 1 )
1347
1379
1348
1380
// At this point, we'll now instruct Carol to force close the tx. This
1349
1381
// will let us exercise that Bob is able to sweep the expired HTLC on
@@ -1600,9 +1632,18 @@ func runLocalClaimIncomingHTLC(ht *lntest.HarnessTest,
1600
1632
1601
1633
// At this point, all 3 nodes should now have an active channel with
1602
1634
// the created HTLC pending on all of them.
1603
- ht .AssertActiveHtlcs (alice , payHash [:])
1604
- ht .AssertActiveHtlcs (bob , payHash [:])
1605
- ht .AssertActiveHtlcs (carol , payHash [:])
1635
+ // At this point, all 3 nodes should now have an active channel with
1636
+ // the created HTLCs pending on all of them.
1637
+ //
1638
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1639
+ ht .AssertNumActiveHtlcs (alice , 1 )
1640
+
1641
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1642
+ // outgoing HTLC on channel Bob -> Carol.
1643
+ ht .AssertNumActiveHtlcs (bob , 2 )
1644
+
1645
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1646
+ ht .AssertNumActiveHtlcs (carol , 1 )
1606
1647
1607
1648
// Wait for carol to mark invoice as accepted. There is a small gap to
1608
1649
// bridge between adding the htlc to the channel and executing the exit
@@ -1903,9 +1944,18 @@ func runLocalClaimIncomingHTLCLeased(ht *lntest.HarnessTest,
1903
1944
1904
1945
// At this point, all 3 nodes should now have an active channel with
1905
1946
// the created HTLC pending on all of them.
1906
- ht .AssertActiveHtlcs (alice , payHash [:])
1907
- ht .AssertActiveHtlcs (bob , payHash [:])
1908
- ht .AssertActiveHtlcs (carol , payHash [:])
1947
+ // At this point, all 3 nodes should now have an active channel with
1948
+ // the created HTLCs pending on all of them.
1949
+ //
1950
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1951
+ ht .AssertNumActiveHtlcs (alice , 1 )
1952
+
1953
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1954
+ // outgoing HTLC on channel Bob -> Carol.
1955
+ ht .AssertNumActiveHtlcs (bob , 2 )
1956
+
1957
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1958
+ ht .AssertNumActiveHtlcs (carol , 1 )
1909
1959
1910
1960
// Wait for carol to mark invoice as accepted. There is a small gap to
1911
1961
// bridge between adding the htlc to the channel and executing the exit
@@ -2257,10 +2307,17 @@ func runLocalPreimageClaim(ht *lntest.HarnessTest,
2257
2307
ht .SendPaymentAssertInflight (alice , req )
2258
2308
2259
2309
// At this point, all 3 nodes should now have an active channel with
2260
- // the created HTLC pending on all of them.
2261
- ht .AssertActiveHtlcs (alice , payHash [:])
2262
- ht .AssertActiveHtlcs (bob , payHash [:])
2263
- ht .AssertActiveHtlcs (carol , payHash [:])
2310
+ // the created HTLCs pending on all of them.
2311
+ //
2312
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
2313
+ ht .AssertNumActiveHtlcs (alice , 1 )
2314
+
2315
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
2316
+ // outgoing HTLC on channel Bob -> Carol.
2317
+ ht .AssertNumActiveHtlcs (bob , 2 )
2318
+
2319
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
2320
+ ht .AssertNumActiveHtlcs (carol , 1 )
2264
2321
2265
2322
// Wait for carol to mark invoice as accepted. There is a small gap to
2266
2323
// bridge between adding the htlc to the channel and executing the exit
@@ -2540,10 +2597,17 @@ func runLocalPreimageClaimLeased(ht *lntest.HarnessTest,
2540
2597
ht .SendPaymentAssertInflight (alice , req )
2541
2598
2542
2599
// At this point, all 3 nodes should now have an active channel with
2543
- // the created HTLC pending on all of them.
2544
- ht .AssertActiveHtlcs (alice , payHash [:])
2545
- ht .AssertActiveHtlcs (bob , payHash [:])
2546
- ht .AssertActiveHtlcs (carol , payHash [:])
2600
+ // the created HTLCs pending on all of them.
2601
+ //
2602
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
2603
+ ht .AssertNumActiveHtlcs (alice , 1 )
2604
+
2605
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
2606
+ // outgoing HTLC on channel Bob -> Carol.
2607
+ ht .AssertNumActiveHtlcs (bob , 2 )
2608
+
2609
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
2610
+ ht .AssertNumActiveHtlcs (carol , 1 )
2547
2611
2548
2612
// Wait for carol to mark invoice as accepted. There is a small gap to
2549
2613
// bridge between adding the htlc to the channel and executing the exit
@@ -2997,11 +3061,20 @@ func runHtlcAggregation(ht *lntest.HarnessTest,
2997
3061
ht .SendPaymentAssertInflight (carol , req )
2998
3062
}
2999
3063
3000
- // At this point, all 3 nodes should now the HTLCs active on their
3001
- // channels.
3002
- ht .AssertActiveHtlcs (alice , payHashes ... )
3003
- ht .AssertActiveHtlcs (bob , payHashes ... )
3004
- ht .AssertActiveHtlcs (carol , payHashes ... )
3064
+ // At this point, all 3 nodes should now have an active channel with
3065
+ // the created HTLCs pending on all of them.
3066
+ //
3067
+ // Alice sent numInvoices and received numInvoices payments, she should
3068
+ // have numInvoices*2 HTLCs.
3069
+ ht .AssertNumActiveHtlcs (alice , numInvoices * 2 )
3070
+
3071
+ // Bob should have 2*numInvoices HTLCs on channel Alice -> Bob, and
3072
+ // numInvoices*2 HTLCs on channel Bob -> Carol.
3073
+ ht .AssertNumActiveHtlcs (bob , numInvoices * 4 )
3074
+
3075
+ // Carol sent numInvoices and received numInvoices payments, she should
3076
+ // have numInvoices*2 HTLCs.
3077
+ ht .AssertNumActiveHtlcs (carol , numInvoices * 2 )
3005
3078
3006
3079
// Wait for Alice and Carol to mark the invoices as accepted. There is
3007
3080
// a small gap to bridge between adding the htlc to the channel and
0 commit comments