@@ -328,11 +328,18 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
328
328
}
329
329
ht .SendPaymentAssertInflight (alice , req )
330
330
331
- // Verify that all nodes in the path now have two HTLC's with the
332
- // proper parameters.
333
- ht .AssertActiveHtlcs (alice , dustPayHash , payHash )
334
- ht .AssertActiveHtlcs (bob , dustPayHash , payHash )
335
- ht .AssertActiveHtlcs (carol , dustPayHash , payHash )
331
+ // At this point, all 3 nodes should now have an active channel with
332
+ // the created HTLC pending on all of them.
333
+ //
334
+ // Alice should have two outgoing HTLCs on channel Alice -> Bob.
335
+ ht .AssertNumActiveHtlcs (alice , 2 )
336
+
337
+ // Bob should have two incoming HTLCs on channel Alice -> Bob, and two
338
+ // outgoing HTLCs on channel Bob -> Carol.
339
+ ht .AssertNumActiveHtlcs (bob , 4 )
340
+
341
+ // Carol should have two incoming HTLCs on channel Bob -> Carol.
342
+ ht .AssertNumActiveHtlcs (carol , 2 )
336
343
337
344
// We'll now mine enough blocks to trigger Bob's force close the
338
345
// channel Bob=>Carol due to the fact that the HTLC is about to
@@ -372,7 +379,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
372
379
// At this point, Bob should have canceled backwards the dust HTLC that
373
380
// we sent earlier. This means Alice should now only have a single HTLC
374
381
// on her channel.
375
- ht .AssertActiveHtlcs (alice , payHash )
382
+ ht .AssertNumActiveHtlcs (alice , 1 )
376
383
377
384
// With the closing transaction confirmed, we should expect Bob's HTLC
378
385
// timeout transaction to be offered to the sweeper due to the expiry
@@ -659,9 +666,18 @@ func runMultiHopReceiverPreimageClaim(ht *lntest.HarnessTest,
659
666
660
667
// At this point, all 3 nodes should now have an active channel with
661
668
// the created HTLC pending on all of them.
662
- ht .AssertActiveHtlcs (alice , payHash [:])
663
- ht .AssertActiveHtlcs (bob , payHash [:])
664
- ht .AssertActiveHtlcs (carol , payHash [:])
669
+ // At this point, all 3 nodes should now have an active channel with
670
+ // the created HTLCs pending on all of them.
671
+ //
672
+ // Alice should have one outgoing HTLCs on channel Alice -> Bob.
673
+ ht .AssertNumActiveHtlcs (alice , 1 )
674
+
675
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
676
+ // outgoing HTLC on channel Bob -> Carol.
677
+ ht .AssertNumActiveHtlcs (bob , 2 )
678
+
679
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
680
+ ht .AssertNumActiveHtlcs (carol , 1 )
665
681
666
682
// Wait for Carol to mark invoice as accepted. There is a small gap to
667
683
// bridge between adding the htlc to the channel and executing the exit
@@ -1018,11 +1034,20 @@ func runLocalForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
1018
1034
}
1019
1035
ht .SendPaymentAssertInflight (alice , req )
1020
1036
1021
- // Once the HTLC has cleared, all channels in our mini network should
1022
- // have the it locked in.
1023
- ht .AssertActiveHtlcs (alice , payHash )
1024
- ht .AssertActiveHtlcs (bob , payHash )
1025
- ht .AssertActiveHtlcs (carol , payHash )
1037
+ // At this point, all 3 nodes should now have an active channel with
1038
+ // the created HTLC pending on all of them.
1039
+ // At this point, all 3 nodes should now have an active channel with
1040
+ // the created HTLCs pending on all of them.
1041
+ //
1042
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1043
+ ht .AssertNumActiveHtlcs (alice , 1 )
1044
+
1045
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1046
+ // outgoing HTLC on channel Bob -> Carol.
1047
+ ht .AssertNumActiveHtlcs (bob , 2 )
1048
+
1049
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1050
+ ht .AssertNumActiveHtlcs (carol , 1 )
1026
1051
1027
1052
// Now that all parties have the HTLC locked in, we'll immediately
1028
1053
// force close the Bob -> Carol channel. This should trigger contract
@@ -1347,11 +1372,18 @@ func runRemoteForceCloseBeforeHtlcTimeout(ht *lntest.HarnessTest,
1347
1372
}
1348
1373
ht .SendPaymentAssertInflight (alice , req )
1349
1374
1350
- // Once the HTLC has cleared, all the nodes in our mini network should
1351
- // show that the HTLC has been locked in.
1352
- ht .AssertActiveHtlcs (alice , payHash [:])
1353
- ht .AssertActiveHtlcs (bob , payHash [:])
1354
- ht .AssertActiveHtlcs (carol , payHash [:])
1375
+ // At this point, all 3 nodes should now have an active channel with
1376
+ // the created HTLCs pending on all of them.
1377
+ //
1378
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1379
+ ht .AssertNumActiveHtlcs (alice , 1 )
1380
+
1381
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1382
+ // outgoing HTLC on channel Bob -> Carol.
1383
+ ht .AssertNumActiveHtlcs (bob , 2 )
1384
+
1385
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1386
+ ht .AssertNumActiveHtlcs (carol , 1 )
1355
1387
1356
1388
// At this point, we'll now instruct Carol to force close the tx. This
1357
1389
// will let us exercise that Bob is able to sweep the expired HTLC on
@@ -1608,9 +1640,18 @@ func runLocalClaimIncomingHTLC(ht *lntest.HarnessTest,
1608
1640
1609
1641
// At this point, all 3 nodes should now have an active channel with
1610
1642
// the created HTLC pending on all of them.
1611
- ht .AssertActiveHtlcs (alice , payHash [:])
1612
- ht .AssertActiveHtlcs (bob , payHash [:])
1613
- ht .AssertActiveHtlcs (carol , payHash [:])
1643
+ // At this point, all 3 nodes should now have an active channel with
1644
+ // the created HTLCs pending on all of them.
1645
+ //
1646
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1647
+ ht .AssertNumActiveHtlcs (alice , 1 )
1648
+
1649
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1650
+ // outgoing HTLC on channel Bob -> Carol.
1651
+ ht .AssertNumActiveHtlcs (bob , 2 )
1652
+
1653
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1654
+ ht .AssertNumActiveHtlcs (carol , 1 )
1614
1655
1615
1656
// Wait for carol to mark invoice as accepted. There is a small gap to
1616
1657
// bridge between adding the htlc to the channel and executing the exit
@@ -1919,9 +1960,18 @@ func runLocalClaimIncomingHTLCLeased(ht *lntest.HarnessTest,
1919
1960
1920
1961
// At this point, all 3 nodes should now have an active channel with
1921
1962
// the created HTLC pending on all of them.
1922
- ht .AssertActiveHtlcs (alice , payHash [:])
1923
- ht .AssertActiveHtlcs (bob , payHash [:])
1924
- ht .AssertActiveHtlcs (carol , payHash [:])
1963
+ // At this point, all 3 nodes should now have an active channel with
1964
+ // the created HTLCs pending on all of them.
1965
+ //
1966
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
1967
+ ht .AssertNumActiveHtlcs (alice , 1 )
1968
+
1969
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
1970
+ // outgoing HTLC on channel Bob -> Carol.
1971
+ ht .AssertNumActiveHtlcs (bob , 2 )
1972
+
1973
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
1974
+ ht .AssertNumActiveHtlcs (carol , 1 )
1925
1975
1926
1976
// Wait for carol to mark invoice as accepted. There is a small gap to
1927
1977
// bridge between adding the htlc to the channel and executing the exit
@@ -2273,10 +2323,17 @@ func runLocalPreimageClaim(ht *lntest.HarnessTest,
2273
2323
ht .SendPaymentAssertInflight (alice , req )
2274
2324
2275
2325
// At this point, all 3 nodes should now have an active channel with
2276
- // the created HTLC pending on all of them.
2277
- ht .AssertActiveHtlcs (alice , payHash [:])
2278
- ht .AssertActiveHtlcs (bob , payHash [:])
2279
- ht .AssertActiveHtlcs (carol , payHash [:])
2326
+ // the created HTLCs pending on all of them.
2327
+ //
2328
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
2329
+ ht .AssertNumActiveHtlcs (alice , 1 )
2330
+
2331
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
2332
+ // outgoing HTLC on channel Bob -> Carol.
2333
+ ht .AssertNumActiveHtlcs (bob , 2 )
2334
+
2335
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
2336
+ ht .AssertNumActiveHtlcs (carol , 1 )
2280
2337
2281
2338
// Wait for carol to mark invoice as accepted. There is a small gap to
2282
2339
// bridge between adding the htlc to the channel and executing the exit
@@ -2556,10 +2613,17 @@ func runLocalPreimageClaimLeased(ht *lntest.HarnessTest,
2556
2613
ht .SendPaymentAssertInflight (alice , req )
2557
2614
2558
2615
// At this point, all 3 nodes should now have an active channel with
2559
- // the created HTLC pending on all of them.
2560
- ht .AssertActiveHtlcs (alice , payHash [:])
2561
- ht .AssertActiveHtlcs (bob , payHash [:])
2562
- ht .AssertActiveHtlcs (carol , payHash [:])
2616
+ // the created HTLCs pending on all of them.
2617
+ //
2618
+ // Alice should have one outgoing HTLC on channel Alice -> Bob.
2619
+ ht .AssertNumActiveHtlcs (alice , 1 )
2620
+
2621
+ // Bob should have one incoming HTLC on channel Alice -> Bob, and one
2622
+ // outgoing HTLC on channel Bob -> Carol.
2623
+ ht .AssertNumActiveHtlcs (bob , 2 )
2624
+
2625
+ // Carol should have one incoming HTLC on channel Bob -> Carol.
2626
+ ht .AssertNumActiveHtlcs (carol , 1 )
2563
2627
2564
2628
// Wait for carol to mark invoice as accepted. There is a small gap to
2565
2629
// bridge between adding the htlc to the channel and executing the exit
@@ -3013,11 +3077,20 @@ func runHtlcAggregation(ht *lntest.HarnessTest,
3013
3077
ht .SendPaymentAssertInflight (carol , req )
3014
3078
}
3015
3079
3016
- // At this point, all 3 nodes should now the HTLCs active on their
3017
- // channels.
3018
- ht .AssertActiveHtlcs (alice , payHashes ... )
3019
- ht .AssertActiveHtlcs (bob , payHashes ... )
3020
- ht .AssertActiveHtlcs (carol , payHashes ... )
3080
+ // At this point, all 3 nodes should now have an active channel with
3081
+ // the created HTLCs pending on all of them.
3082
+ //
3083
+ // Alice sent numInvoices and received numInvoices payments, she should
3084
+ // have numInvoices*2 HTLCs.
3085
+ ht .AssertNumActiveHtlcs (alice , numInvoices * 2 )
3086
+
3087
+ // Bob should have 2*numInvoices HTLCs on channel Alice -> Bob, and
3088
+ // numInvoices*2 HTLCs on channel Bob -> Carol.
3089
+ ht .AssertNumActiveHtlcs (bob , numInvoices * 4 )
3090
+
3091
+ // Carol sent numInvoices and received numInvoices payments, she should
3092
+ // have numInvoices*2 HTLCs.
3093
+ ht .AssertNumActiveHtlcs (carol , numInvoices * 2 )
3021
3094
3022
3095
// Wait for Alice and Carol to mark the invoices as accepted. There is
3023
3096
// a small gap to bridge between adding the htlc to the channel and
0 commit comments