Skip to content

Commit d447ded

Browse files
replace: self.nodes[0] with node
1 parent dddca38 commit d447ded

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

test/functional/mempool_limit.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@ def set_test_params(self):
2323
]]
2424
self.supports_cli = False
2525

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):
2727
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']
2929
for txout in txouts:
3030
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())
3232

3333
def run_test(self):
3434
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']
3738

3839
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'))
4142

4243
tx_batch_size = 25
4344
num_of_batches = 3
@@ -48,32 +49,32 @@ def run_test(self):
4849
self.generate(miniwallet, 1 + (num_of_batches * tx_batch_size) + 1)
4950

5051
# 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)
5253

5354
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"]
5556

5657
# Increase the tx fee rate massively to give the subsequent transactions a higher priority in the mempool
5758
base_fee = relayfee * 1000
5859

5960
self.log.info("Fill up the mempool with txs with higher fee rate")
6061
for batch_of_txid in range(num_of_batches):
6162
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)
6364

6465
self.log.info('The tx should be evicted by now')
6566
# 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()))
6768
# 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()
6970

7071
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'))
7374

7475
# 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
7576
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)
7778

7879

7980
if __name__ == '__main__':

0 commit comments

Comments
 (0)