33# Distributed under the MIT software license, see the accompanying
44# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55"""Helpful routines for mempool testing."""
6- from decimal import Decimal
76
87from .blocktools import (
98 COINBASE_MATURITY ,
@@ -34,9 +33,7 @@ def fill_mempool(test_framework, node, *, tx_sync_fun=None):
3433 """
3534 test_framework .log .info ("Fill the mempool until eviction is triggered and the mempoolminfee rises" )
3635 txouts = gen_return_txouts ()
37- relayfee = node .getnetworkinfo ()['relayfee' ]
38-
39- assert_equal (relayfee , Decimal ('0.00001000' ))
36+ minrelayfee = node .getnetworkinfo ()['relayfee' ]
4037
4138 tx_batch_size = 1
4239 num_of_batches = 75
@@ -56,7 +53,7 @@ def fill_mempool(test_framework, node, *, tx_sync_fun=None):
5653
5754 test_framework .log .debug ("Create a mempool tx that will be evicted" )
5855 tx_to_be_evicted_id = ephemeral_miniwallet .send_self_transfer (
59- from_node = node , utxo_to_spend = confirmed_utxos .pop (0 ), fee_rate = relayfee )["txid" ]
56+ from_node = node , utxo_to_spend = confirmed_utxos .pop (0 ), fee_rate = minrelayfee )["txid" ]
6057
6158 def send_batch (fee ):
6259 utxos = confirmed_utxos [:tx_batch_size ]
@@ -66,14 +63,14 @@ def send_batch(fee):
6663 # Increase the tx fee rate to give the subsequent transactions a higher priority in the mempool
6764 # The tx has an approx. vsize of 65k, i.e. multiplying the previous fee rate (in sats/kvB)
6865 # by 130 should result in a fee that corresponds to 2x of that fee rate
69- base_fee = relayfee * 130
66+ base_fee = minrelayfee * 130
7067 batch_fees = [(i + 1 ) * base_fee for i in range (num_of_batches )]
7168
7269 test_framework .log .debug ("Fill up the mempool with txs with higher fee rate" )
7370 for fee in batch_fees [:- 3 ]:
7471 send_batch (fee )
7572 tx_sync_fun () if tx_sync_fun else test_framework .sync_mempools () # sync before any eviction
76- assert_equal (node .getmempoolinfo ()["mempoolminfee" ], Decimal ( "0.00001000" ) )
73+ assert_equal (node .getmempoolinfo ()["mempoolminfee" ], minrelayfee )
7774 for fee in batch_fees [- 3 :]:
7875 send_batch (fee )
7976 tx_sync_fun () if tx_sync_fun else test_framework .sync_mempools () # sync after all evictions
@@ -85,5 +82,5 @@ def send_batch(fee):
8582 assert tx_to_be_evicted_id not in node .getrawmempool ()
8683
8784 test_framework .log .debug ("Check that mempoolminfee is larger than minrelaytxfee" )
88- assert_equal (node .getmempoolinfo ()['minrelaytxfee' ], Decimal ( '0.00001000' ) )
89- assert_greater_than (node .getmempoolinfo ()['mempoolminfee' ], Decimal ( '0.00001000' ) )
85+ assert_equal (node .getmempoolinfo ()['minrelaytxfee' ], minrelayfee )
86+ assert_greater_than (node .getmempoolinfo ()['mempoolminfee' ], minrelayfee )
0 commit comments