@@ -407,7 +407,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
407
407
408
408
chainNotifier := & mockNotifier {
409
409
oneConfChannel : make (chan * chainntnfs.TxConfirmation , 1 ),
410
- sixConfChannel : make (chan * chainntnfs.TxConfirmation , 1 ),
410
+ sixConfChannel : make (chan * chainntnfs.TxConfirmation , 6 ),
411
411
epochChan : make (chan * chainntnfs.BlockEpoch , 2 ),
412
412
}
413
413
@@ -1496,6 +1496,16 @@ func testNormalWorkflow(t *testing.T, chanType *lnwire.ChannelType) {
1496
1496
assertErrorNotSent (t , alice .msgChan )
1497
1497
assertErrorNotSent (t , bob .msgChan )
1498
1498
1499
+ // We send two notifications:
1500
+ // 1. The first adds the SCID to the database, allowing calculation of
1501
+ // the number of confirmations before the channel is fully opened.
1502
+ // 2. The second marks the channel as open.
1503
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1504
+ Tx : fundingTx ,
1505
+ }
1506
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1507
+ Tx : fundingTx ,
1508
+ }
1499
1509
// Notify that transaction was mined.
1500
1510
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1501
1511
Tx : fundingTx ,
@@ -1809,6 +1819,16 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
1809
1819
}
1810
1820
alice .fundingMgr .cfg .NotifyWhenOnline = notifyWhenOnline
1811
1821
1822
+ // We send two notifications:
1823
+ // 1. The first adds the SCID to the database, allowing calculation of
1824
+ // the number of confirmations before the channel is fully opened.
1825
+ // 2. The second marks the channel as open.
1826
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1827
+ Tx : fundingTx ,
1828
+ }
1829
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1830
+ Tx : fundingTx ,
1831
+ }
1812
1832
// Notify that transaction was mined
1813
1833
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1814
1834
Tx : fundingTx ,
@@ -1969,6 +1989,16 @@ func TestFundingManagerOfflinePeer(t *testing.T) {
1969
1989
conChan <- connected
1970
1990
}
1971
1991
1992
+ // We send two notifications:
1993
+ // 1. The first adds the SCID to the database, allowing calculation of
1994
+ // the number of confirmations before the channel is fully opened.
1995
+ // 2. The second marks the channel as open.
1996
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1997
+ Tx : fundingTx ,
1998
+ }
1999
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2000
+ Tx : fundingTx ,
2001
+ }
1972
2002
// Notify that transaction was mined
1973
2003
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
1974
2004
Tx : fundingTx ,
@@ -2465,6 +2495,16 @@ func TestFundingManagerReceiveChannelReadyTwice(t *testing.T) {
2465
2495
t , alice , bob , localAmt , pushAmt , 1 , updateChan , true , nil ,
2466
2496
)
2467
2497
2498
+ // We send two notifications:
2499
+ // 1. The first adds the SCID to the database, allowing calculation of
2500
+ // the number of confirmations before the channel is fully opened.
2501
+ // 2. The second marks the channel as open.
2502
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2503
+ Tx : fundingTx ,
2504
+ }
2505
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2506
+ Tx : fundingTx ,
2507
+ }
2468
2508
// Notify that transaction was mined
2469
2509
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2470
2510
Tx : fundingTx ,
@@ -2578,6 +2618,16 @@ func TestFundingManagerRestartAfterChanAnn(t *testing.T) {
2578
2618
t , alice , bob , localAmt , pushAmt , 1 , updateChan , true , nil ,
2579
2619
)
2580
2620
2621
+ // We send two notifications:
2622
+ // 1. The first adds the SCID to the database, allowing calculation of
2623
+ // the number of confirmations before the channel is fully opened.
2624
+ // 2. The second marks the channel as open.
2625
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2626
+ Tx : fundingTx ,
2627
+ }
2628
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2629
+ Tx : fundingTx ,
2630
+ }
2581
2631
// Notify that transaction was mined
2582
2632
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2583
2633
Tx : fundingTx ,
@@ -2677,6 +2727,16 @@ func TestFundingManagerRestartAfterReceivingChannelReady(t *testing.T) {
2677
2727
t , alice , bob , localAmt , pushAmt , 1 , updateChan , true , nil ,
2678
2728
)
2679
2729
2730
+ // We send two notifications:
2731
+ // 1. The first adds the SCID to the database, allowing calculation of
2732
+ // the number of confirmations before the channel is fully opened.
2733
+ // 2. The second marks the channel as open.
2734
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2735
+ Tx : fundingTx ,
2736
+ }
2737
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2738
+ Tx : fundingTx ,
2739
+ }
2680
2740
// Notify that transaction was mined
2681
2741
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2682
2742
Tx : fundingTx ,
@@ -2772,6 +2832,16 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
2772
2832
t , alice , bob , localAmt , pushAmt , 1 , updateChan , false , nil ,
2773
2833
)
2774
2834
2835
+ // We send two notifications:
2836
+ // 1. The first adds the SCID to the database, allowing calculation of
2837
+ // the number of confirmations before the channel is fully opened.
2838
+ // 2. The second marks the channel as open.
2839
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2840
+ Tx : fundingTx ,
2841
+ }
2842
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2843
+ Tx : fundingTx ,
2844
+ }
2775
2845
// Notify that transaction was mined
2776
2846
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2777
2847
Tx : fundingTx ,
@@ -2897,6 +2967,16 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
2897
2967
t , alice , bob , localAmt , pushAmt , 1 , updateChan , false , nil ,
2898
2968
)
2899
2969
2970
+ // We send two notifications:
2971
+ // 1. The first adds the SCID to the database, allowing calculation of
2972
+ // the number of confirmations before the channel is fully opened.
2973
+ // 2. The second marks the channel as open.
2974
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2975
+ Tx : fundingTx ,
2976
+ }
2977
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2978
+ Tx : fundingTx ,
2979
+ }
2900
2980
// Notify that transaction was mined
2901
2981
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
2902
2982
Tx : fundingTx ,
@@ -3339,6 +3419,16 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
3339
3419
t .Fatalf ("alice did not publish funding tx" )
3340
3420
}
3341
3421
3422
+ // We send two notifications:
3423
+ // 1. The first adds the SCID to the database, allowing calculation of
3424
+ // the number of confirmations before the channel is fully opened.
3425
+ // 2. The second marks the channel as open.
3426
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3427
+ Tx : fundingTx ,
3428
+ }
3429
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3430
+ Tx : fundingTx ,
3431
+ }
3342
3432
// Notify that transaction was mined.
3343
3433
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3344
3434
Tx : fundingTx ,
@@ -3675,6 +3765,17 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) {
3675
3765
3676
3766
// Notify that the transactions were mined.
3677
3767
for i := 0 ; i < maxPending ; i ++ {
3768
+ // We send two notifications:
3769
+ // 1. The first adds the SCID to the database, allowing
3770
+ // calculation of the number of confirmations before the
3771
+ // channel is fully opened.
3772
+ // 2. The second marks the channel as open.
3773
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3774
+ Tx : txs [i ],
3775
+ }
3776
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3777
+ Tx : txs [i ],
3778
+ }
3678
3779
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
3679
3780
Tx : txs [i ],
3680
3781
}
@@ -4954,10 +5055,19 @@ func TestFundingManagerCoinbase(t *testing.T) {
4954
5055
// Send along the oneConfChannel again and then assert that the open
4955
5056
// event is sent. This serves as the 100 block + MinAcceptDepth
4956
5057
// confirmation.
5058
+ // We send two notifications:
5059
+ // 1. The first adds the SCID to the database, allowing calculation of
5060
+ // the number of confirmations before the channel is fully opened.
5061
+ // 2. The second marks the channel as open.
5062
+ alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
5063
+ Tx : fundingTx ,
5064
+ }
5065
+ bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
5066
+ Tx : fundingTx ,
5067
+ }
4957
5068
alice .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
4958
5069
Tx : fundingTx ,
4959
5070
}
4960
-
4961
5071
bob .mockNotifier .oneConfChannel <- & chainntnfs.TxConfirmation {
4962
5072
Tx : fundingTx ,
4963
5073
}
0 commit comments