@@ -23,21 +23,22 @@ def set_test_params(self):
23
23
]]
24
24
self .supports_cli = False
25
25
26
- def send_large_txs (self , miniwallet , txouts , fee_rate , tx_batch_size ):
26
+ def send_large_txs (self , node , miniwallet , txouts , fee_rate , tx_batch_size ):
27
27
for _ in range (tx_batch_size ):
28
- tx = miniwallet .create_self_transfer (from_node = self . nodes [ 0 ] , fee_rate = fee_rate )['tx' ]
28
+ tx = miniwallet .create_self_transfer (from_node = node , fee_rate = fee_rate )['tx' ]
29
29
for txout in txouts :
30
30
tx .vout .append (txout )
31
- miniwallet .sendrawtransaction (from_node = self . nodes [ 0 ] , tx_hex = tx .serialize ().hex ())
31
+ miniwallet .sendrawtransaction (from_node = node , tx_hex = tx .serialize ().hex ())
32
32
33
33
def run_test (self ):
34
34
txouts = gen_return_txouts ()
35
- miniwallet = MiniWallet (self .nodes [0 ])
36
- relayfee = self .nodes [0 ].getnetworkinfo ()['relayfee' ]
35
+ node = self .nodes [0 ]
36
+ miniwallet = MiniWallet (node )
37
+ relayfee = node .getnetworkinfo ()['relayfee' ]
37
38
38
39
self .log .info ('Check that mempoolminfee is minrelytxfee' )
39
- assert_equal (self . nodes [ 0 ] .getmempoolinfo ()['minrelaytxfee' ], Decimal ('0.00001000' ))
40
- assert_equal (self . nodes [ 0 ] .getmempoolinfo ()['mempoolminfee' ], Decimal ('0.00001000' ))
40
+ assert_equal (node .getmempoolinfo ()['minrelaytxfee' ], Decimal ('0.00001000' ))
41
+ assert_equal (node .getmempoolinfo ()['mempoolminfee' ], Decimal ('0.00001000' ))
41
42
42
43
tx_batch_size = 25
43
44
num_of_batches = 3
@@ -48,32 +49,32 @@ def run_test(self):
48
49
self .generate (miniwallet , 1 + (num_of_batches * tx_batch_size ) + 1 )
49
50
50
51
# Mine 99 blocks so that the UTXOs are allowed to be spent
51
- self .generate (self . nodes [ 0 ] , COINBASE_MATURITY - 1 )
52
+ self .generate (node , COINBASE_MATURITY - 1 )
52
53
53
54
self .log .info ('Create a mempool tx that will be evicted' )
54
- tx_to_be_evicted_id = miniwallet .send_self_transfer (from_node = self . nodes [ 0 ] , fee_rate = relayfee )["txid" ]
55
+ tx_to_be_evicted_id = miniwallet .send_self_transfer (from_node = node , fee_rate = relayfee )["txid" ]
55
56
56
57
# Increase the tx fee rate massively to give the subsequent transactions a higher priority in the mempool
57
58
base_fee = relayfee * 1000
58
59
59
60
self .log .info ("Fill up the mempool with txs with higher fee rate" )
60
61
for batch_of_txid in range (num_of_batches ):
61
62
fee_rate = (batch_of_txid + 1 ) * base_fee
62
- self .send_large_txs (miniwallet , txouts , fee_rate , tx_batch_size )
63
+ self .send_large_txs (node , miniwallet , txouts , fee_rate , tx_batch_size )
63
64
64
65
self .log .info ('The tx should be evicted by now' )
65
66
# The number of transactions created should be greater than the ones present in the mempool
66
- assert_greater_than (tx_batch_size * num_of_batches , len (self . nodes [ 0 ] .getrawmempool ()))
67
+ assert_greater_than (tx_batch_size * num_of_batches , len (node .getrawmempool ()))
67
68
# Initial tx created should not be present in the mempool anymore as it had a lower fee rate
68
- assert tx_to_be_evicted_id not in self . nodes [ 0 ] .getrawmempool ()
69
+ assert tx_to_be_evicted_id not in node .getrawmempool ()
69
70
70
71
self .log .info ('Check that mempoolminfee is larger than minrelytxfee' )
71
- assert_equal (self . nodes [ 0 ] .getmempoolinfo ()['minrelaytxfee' ], Decimal ('0.00001000' ))
72
- assert_greater_than (self . nodes [ 0 ] .getmempoolinfo ()['mempoolminfee' ], Decimal ('0.00001000' ))
72
+ assert_equal (node .getmempoolinfo ()['minrelaytxfee' ], Decimal ('0.00001000' ))
73
+ assert_greater_than (node .getmempoolinfo ()['mempoolminfee' ], Decimal ('0.00001000' ))
73
74
74
75
# Deliberately try to create a tx with a fee less than the minimum mempool fee to assert that it does not get added to the mempool
75
76
self .log .info ('Create a mempool tx that will not pass mempoolminfee' )
76
- assert_raises_rpc_error (- 26 , "mempool min fee not met" , miniwallet .send_self_transfer , from_node = self . nodes [ 0 ] , fee_rate = relayfee , mempool_valid = False )
77
+ assert_raises_rpc_error (- 26 , "mempool min fee not met" , miniwallet .send_self_transfer , from_node = node , fee_rate = relayfee , mempool_valid = False )
77
78
78
79
79
80
if __name__ == '__main__' :
0 commit comments