@@ -982,38 +982,51 @@ def test_closing(self):
982
982
983
983
def test_closing_different_fees (self ):
984
984
l1 = self .node_factory .get_node ()
985
- self .give_funds (l1 , (10 ** 6 ) * 5 + 1000000 )
986
985
987
986
# Default feerate = 15000/7500/1000
988
- # It will accept between upper and lower feerate, starting at normal.
989
- for feerates in [ [ 20000 , 15000 , 7400 ],
990
- [ 15000 , 8000 , 1000 ],
991
- [ 15000 , 6000 , 1000 ],
992
- [ 8000 , 7500 , 1000 ],
993
- [ 8000 , 1200 , 100 ] ]:
994
- # With and without dust
995
- for pamount in [ 0 , 545999 , 546000 , 546001 , 10 ** 6 // 2 ]:
996
- l2 = self .node_factory .get_node (options = ['--override-fee-rates={}/{}/{}'
997
- .format (feerates [0 ],
998
- feerates [1 ],
999
- feerates [2 ])])
1000
-
1001
- l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .info ['port' ])
1002
-
1003
- self .fund_channel (l1 , l2 , 10 ** 6 )
1004
- if pamount > 0 :
1005
- self .pay (l1 , l2 , pamount )
1006
-
1007
- l1 .rpc .close (l2 .info ['id' ])
1008
- l1 .daemon .wait_for_log (' to CHANNELD_SHUTTING_DOWN' )
1009
- l2 .daemon .wait_for_log (' to CHANNELD_SHUTTING_DOWN' )
1010
-
1011
- l1 .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
1012
- l2 .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
1013
-
1014
- bitcoind .generate_block (1 )
1015
- l1 .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
1016
- l2 .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
987
+ # It will start at the second number, accepting anything above the first.
988
+ feerates = [ [ 20000 , 15000 , 7400 ],
989
+ [ 8000 , 1001 , 100 ] ]
990
+ amounts = [ 0 , 545999 , 546000 ]
991
+ num_peers = len (feerates ) * len (amounts )
992
+ self .give_funds (l1 , (10 ** 6 ) * num_peers + 10000 * num_peers )
993
+
994
+ # Create them in a batch, but only valgrind one in three, for speed!
995
+ peers = []
996
+ for feerate in feerates :
997
+ for amount in amounts :
998
+ p = self .node_factory .get_node (options = ['--override-fee-rates={}/{}/{}'
999
+ .format (feerate [0 ],
1000
+ feerate [1 ],
1001
+ feerate [2 ])])
1002
+ p .feerate = feerate
1003
+ p .amount = amount
1004
+ l1 .rpc .connect (p .info ['id' ], 'localhost' , p .info ['port' ])
1005
+ peers .append (p )
1006
+
1007
+ for p in peers :
1008
+ l1 .rpc .fundchannel (p .info ['id' ], 10 ** 6 )
1009
+
1010
+ bitcoind .generate_block (6 )
1011
+
1012
+ # Now wait for them all to hit normal state, do payments
1013
+ for p in peers :
1014
+ p .daemon .wait_for_log ('to CHANNELD_NORMAL' )
1015
+ if p .amount != 0 :
1016
+ self .pay (l1 ,p ,100000000 )
1017
+
1018
+ # Now close
1019
+ for p in peers :
1020
+ l1 .rpc .close (p .info ['id' ])
1021
+
1022
+ for p in peers :
1023
+ p .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
1024
+
1025
+ bitcoind .generate_block (1 )
1026
+ for p in peers :
1027
+ p .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
1028
+
1029
+ l1 .daemon .wait_for_logs ([' to ONCHAIND_MUTUAL' ] * num_peers )
1017
1030
1018
1031
@unittest .skipIf (not DEVELOPER , "needs DEVELOPER=1" )
1019
1032
def test_permfail (self ):
0 commit comments