aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/functional/mempool_package_limits.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/functional/mempool_package_limits.py b/test/functional/mempool_package_limits.py
index 63f5a3e3d3..2315c83c9d 100755
--- a/test/functional/mempool_package_limits.py
+++ b/test/functional/mempool_package_limits.py
@@ -3,20 +3,17 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for limiting mempool and package ancestors/descendants."""
-
-from decimal import Decimal
-
from test_framework.blocktools import COINBASE_MATURITY
-from test_framework.test_framework import BitcoinTestFramework
from test_framework.messages import (
- COIN,
WITNESS_SCALE_FACTOR,
)
+from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
)
from test_framework.wallet import MiniWallet
+
class MempoolPackageLimitsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
@@ -304,8 +301,9 @@ class MempoolPackageLimitsTest(BitcoinTestFramework):
node = self.nodes[0]
assert_equal(0, node.getmempoolinfo()["size"])
parent_utxos = []
- target_weight = WITNESS_SCALE_FACTOR * 1000 * 30 # 30KvB
- high_fee = Decimal("0.003") # 10 sats/vB
+ target_vsize = 30_000
+ high_fee = 10 * target_vsize # 10 sats/vB
+ target_weight = target_vsize * WITNESS_SCALE_FACTOR
self.log.info("Check that in-mempool and in-package ancestor size limits are calculated properly in packages")
# Mempool transactions A and B
for _ in range(2):
@@ -314,7 +312,7 @@ class MempoolPackageLimitsTest(BitcoinTestFramework):
parent_utxos.append(bulked_tx["new_utxo"])
# Package transaction C
- pc_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=parent_utxos, fee_per_output=int(high_fee * COIN), target_weight=target_weight)
+ pc_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=parent_utxos, fee_per_output=high_fee, target_weight=target_weight)
# Package transaction D
pd_tx = self.wallet.create_self_transfer(utxo_to_spend=pc_tx["new_utxos"][0], target_weight=target_weight)
@@ -329,7 +327,7 @@ class MempoolPackageLimitsTest(BitcoinTestFramework):
assert all([res["allowed"] for res in node.testmempoolaccept(rawtxs=[pc_tx["hex"], pd_tx["hex"]])])
def test_desc_size_limits(self):
- """Create 3 mempool transactions and 2 package transactions (25KvB each):
+ """Create 3 mempool transactions and 2 package transactions (21KvB each):
Ma
^ ^
Mb Mc
@@ -340,11 +338,12 @@ class MempoolPackageLimitsTest(BitcoinTestFramework):
"""
node = self.nodes[0]
assert_equal(0, node.getmempoolinfo()["size"])
- target_weight = 21 * 1000 * WITNESS_SCALE_FACTOR
- high_fee = Decimal("0.0021") # 10 sats/vB
+ target_vsize = 21_000
+ high_fee = 10 * target_vsize # 10 sats/vB
+ target_weight = target_vsize * WITNESS_SCALE_FACTOR
self.log.info("Check that in-mempool and in-package descendant sizes are calculated properly in packages")
# Top parent in mempool, Ma
- ma_tx = self.wallet.create_self_transfer_multi(num_outputs=2, fee_per_output=int(high_fee / 2 * COIN), target_weight=target_weight)
+ ma_tx = self.wallet.create_self_transfer_multi(num_outputs=2, fee_per_output=high_fee // 2, target_weight=target_weight)
self.wallet.sendrawtransaction(from_node=node, tx_hex=ma_tx["hex"])
package_hex = []
@@ -367,5 +366,6 @@ class MempoolPackageLimitsTest(BitcoinTestFramework):
self.generate(node, 1)
assert all([res["allowed"] for res in node.testmempoolaccept(rawtxs=package_hex)])
+
if __name__ == "__main__":
MempoolPackageLimitsTest().main()