@@ -894,38 +894,52 @@ def test_closing(self):
894
894
895
895
def test_closing_different_fees (self ):
896
896
l1 = self .node_factory .get_node ()
897
- self .give_funds (l1 , (10 ** 6 ) * 5 + 1000000 )
898
897
899
898
# Default feerate = 15000/7500/1000
900
- # It will accept between upper and lower feerate, starting at normal.
901
- for feerates in [ [ 20000 , 15000 , 7400 ],
902
- [ 15000 , 8000 , 1000 ],
903
- [ 15000 , 6000 , 1000 ],
904
- [ 8000 , 7500 , 1000 ],
905
- [ 8000 , 1200 , 100 ] ]:
906
- # With and without dust
907
- for pamount in [ 0 , 545999 , 546000 , 546001 , 10 ** 6 // 2 ]:
908
- l2 = self .node_factory .get_node (options = ['--override-fee-rates={}/{}/{}'
909
- .format (feerates [0 ],
910
- feerates [1 ],
911
- feerates [2 ])])
912
-
913
- l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .info ['port' ])
914
-
915
- self .fund_channel (l1 , l2 , 10 ** 6 )
916
- if pamount > 0 :
917
- self .pay (l1 , l2 , pamount )
918
-
919
- l1 .rpc .close (l2 .info ['id' ])
920
- l1 .daemon .wait_for_log (' to CHANNELD_SHUTTING_DOWN' )
921
- l2 .daemon .wait_for_log (' to CHANNELD_SHUTTING_DOWN' )
922
-
923
- l1 .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
924
- l2 .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
925
-
926
- bitcoind .generate_block (1 )
927
- l1 .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
928
- l2 .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
899
+ # It will start at the second number, accepting anything above the first.
900
+ feerates = [ [ 20000 , 15000 , 7400 ],
901
+ [ 8000 , 1001 , 100 ] ]
902
+ amounts = [ 0 , 545999 , 546000 ]
903
+ num_peers = len (feerates ) * len (amounts )
904
+ self .give_funds (l1 , (10 ** 6 ) * num_peers + 10000 * num_peers )
905
+
906
+ # Create them in a batch, but only valgrind one in three, for speed!
907
+ peers = []
908
+ for feerate in feerates :
909
+ for amount in amounts :
910
+ p = self .node_factory .get_node (options = ['--override-fee-rates={}/{}/{}'
911
+ .format (feerate [0 ],
912
+ feerate [1 ],
913
+ feerate [2 ])])
914
+ p .feerate = feerate
915
+ p .amount = amount
916
+ l1 .rpc .connect (p .info ['id' ], 'localhost' , p .info ['port' ])
917
+ peers .append (p )
918
+
919
+ for p in peers :
920
+ l1 .rpc .fundchannel (p .info ['id' ], 10 ** 6 )
921
+
922
+ bitcoind .generate_block (6 )
923
+
924
+ # Now wait for them all to hit normal state, start payments
925
+ for p in peers :
926
+ p .daemon .wait_for_log ('to CHANNELD_NORMAL' )
927
+ if p .amount != 0 :
928
+ p .payment = self .pay (l1 ,p ,100000000 ,async = True )
929
+
930
+ for p in peers :
931
+ if p .amount != 0 :
932
+ p .payment .result (10 )
933
+ l1 .rpc .close (p .info ['id' ])
934
+
935
+ for p in peers :
936
+ p .daemon .wait_for_log (' to CLOSINGD_COMPLETE' )
937
+
938
+ bitcoind .generate_block (1 )
939
+ for p in peers :
940
+ p .daemon .wait_for_log (' to ONCHAIND_MUTUAL' )
941
+
942
+ l1 .daemon .wait_for_logs ([' to ONCHAIND_MUTUAL' ] * num_peers )
929
943
930
944
@unittest .skipIf (not DEVELOPER , "needs DEVELOPER=1" )
931
945
def test_permfail (self ):
0 commit comments