v31.1-roots.1 · Commit 4: [PATCH 04/17] feat(mining): preserve Roots priority and template policies
test/functional/mining_basic.py
Before: test/functional/mining_basic.py · After: test/functional/mining_basic.py
File metadata
index 9992786d34cf51f925a57fb3c901b37de4fedfeb..7f8db04715720e75e8d49266906bf6f51aa06e9a 100755
Download original patch · Release notes
Diff rows 1–47 of 47. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/mining_basic.py
CHANGED
|
@@ -55,7 +55,7 @@ MAX_FUTURE_BLOCK_TIME = 2 * 3600
|
|
| 55 |
MAX_TIMEWARP = 600
|
| 56 |
VERSIONBITS_TOP_BITS = 0x20000000
|
| 57 |
VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28
|
| 58 |
-
DEFAULT_BLOCK_MIN_TX_FEE = 1 # default `-blockmintxfee` setting [sat/kvB]
|
| 59 |
|
| 60 |
class MiningTest(BitcoinTestFramework):
|
| 61 |
def set_test_params(self):
|
|
@@ -66,7 +66,7 @@ class MiningTest(BitcoinTestFramework):
|
|
| 66 |
["-fastprune", "-prune=1"]
|
| 67 |
]
|
| 68 |
# Oversized padding outputs exercise block resources, not local carrier limits.
|
| 69 |
-
self.extra_args = [args + ["-maxscriptsize=1000000", "-datacarriersize=1000000"] for args in self.extra_args]
|
| 70 |
self.setup_clean_chain = True
|
| 71 |
|
| 72 |
def mine_chain(self):
|
|
@@ -146,7 +146,7 @@ class MiningTest(BitcoinTestFramework):
|
|
| 146 |
node = self.nodes[0]
|
| 147 |
|
| 148 |
# test default (no parameter), zero and a bunch of arbitrary blockmintxfee rates [sat/kvB]
|
| 149 |
-
for blockmintxfee_sat_kvb in (DEFAULT_BLOCK_MIN_TX_FEE, 0, 5, 10, 50, 100, 500, 1000, 2500, 5000, 21000, 333333, 2500000):
|
| 150 |
blockmintxfee_btc_kvb = blockmintxfee_sat_kvb / Decimal(COIN)
|
| 151 |
if blockmintxfee_sat_kvb == DEFAULT_BLOCK_MIN_TX_FEE:
|
| 152 |
self.log.info(f"-> Default -blockmintxfee setting ({blockmintxfee_sat_kvb} sat/kvB)...")
|
|
@@ -310,11 +310,11 @@ class MiningTest(BitcoinTestFramework):
|
|
| 310 |
self.log.info(f"Testing that the mempool contains {LARGE_TXS_COUNT + 2} transactions.")
|
| 311 |
assert_equal(len(self.nodes[0].getrawmempool()), LARGE_TXS_COUNT + 2)
|
| 312 |
|
| 313 |
-
# Verify the block template includes only the 10 high-fee transactions
|
| 314 |
-
self.log.info("Testing that the block template includes only the 10 large transactions.")
|
| 315 |
self.verify_block_template(
|
| 316 |
-
expected_tx_count=LARGE_TXS_COUNT,
|
| 317 |
-
expected_weight=MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT,
|
| 318 |
)
|
| 319 |
|
| 320 |
# Test block template creation with custom -blockmaxweight
|
|
@@ -344,7 +344,7 @@ class MiningTest(BitcoinTestFramework):
|
|
| 344 |
|
| 345 |
self.log.info("Test -blockreservedweight startup option.")
|
| 346 |
# Lowering the -blockreservedweight by 4000 will allow for two more transactions.
|
| 347 |
-
self.restart_node(0, extra_args=self.extra_args[0] + ["-blockreservedweight=4000"])
|
| 348 |
self.verify_block_template(
|
| 349 |
expected_tx_count=12,
|
| 350 |
expected_weight=MAX_BLOCK_WEIGHT - 4000,
|
|
|
|
| 55 |
MAX_TIMEWARP = 600
|
| 56 |
VERSIONBITS_TOP_BITS = 0x20000000
|
| 57 |
VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28
|
| 58 |
+
DEFAULT_BLOCK_MIN_TX_FEE = 1000 # default `-blockmintxfee` setting [sat/kvB]
|
| 59 |
|
| 60 |
class MiningTest(BitcoinTestFramework):
|
| 61 |
def set_test_params(self):
|
|
|
|
| 66 |
["-fastprune", "-prune=1"]
|
| 67 |
]
|
| 68 |
# Oversized padding outputs exercise block resources, not local carrier limits.
|
| 69 |
+
self.extra_args = [args + ["-maxscriptsize=1000000", "-datacarriersize=1000000", "-blockprioritysize=0"] for args in self.extra_args]
|
| 70 |
self.setup_clean_chain = True
|
| 71 |
|
| 72 |
def mine_chain(self):
|
|
|
|
| 146 |
node = self.nodes[0]
|
| 147 |
|
| 148 |
# test default (no parameter), zero and a bunch of arbitrary blockmintxfee rates [sat/kvB]
|
| 149 |
+
for blockmintxfee_sat_kvb in (DEFAULT_BLOCK_MIN_TX_FEE, 0, 5, 10, 50, 100, 500, 2500, 5000, 21000, 333333, 2500000):
|
| 150 |
blockmintxfee_btc_kvb = blockmintxfee_sat_kvb / Decimal(COIN)
|
| 151 |
if blockmintxfee_sat_kvb == DEFAULT_BLOCK_MIN_TX_FEE:
|
| 152 |
self.log.info(f"-> Default -blockmintxfee setting ({blockmintxfee_sat_kvb} sat/kvB)...")
|
|
|
|
| 310 |
self.log.info(f"Testing that the mempool contains {LARGE_TXS_COUNT + 2} transactions.")
|
| 311 |
assert_equal(len(self.nodes[0].getrawmempool()), LARGE_TXS_COUNT + 2)
|
| 312 |
|
| 313 |
+
# Roots' default 1,200,000-weight cap fits two large and both normal txs.
|
| 314 |
+
self.log.info("Testing the default Roots block template weight limit.")
|
| 315 |
self.verify_block_template(
|
| 316 |
+
expected_tx_count=4,
|
| 317 |
+
expected_weight=1_200_000 - DEFAULT_BLOCK_RESERVED_WEIGHT,
|
| 318 |
)
|
| 319 |
|
| 320 |
# Test block template creation with custom -blockmaxweight
|
|
|
|
| 344 |
|
| 345 |
self.log.info("Test -blockreservedweight startup option.")
|
| 346 |
# Lowering the -blockreservedweight by 4000 will allow for two more transactions.
|
| 347 |
+
self.restart_node(0, extra_args=self.extra_args[0] + ["-blockreservedweight=4000", f"-blockmaxweight={MAX_BLOCK_WEIGHT}"])
|
| 348 |
self.verify_block_template(
|
| 349 |
expected_tx_count=12,
|
| 350 |
expected_weight=MAX_BLOCK_WEIGHT - 4000,
|