Skip to content
Bitcoin Roots

v29.4-roots.4 · Commit 10: [PATCH 10/37] fix: harden final Roots assurance

test/functional/mining_basic.py

Before: test/functional/mining_basic.py · After: test/functional/mining_basic.py

File metadata
index 72f92c85a09c031738bf7c94cfc1021964a8201b..e69aca5eaddef2ff218fd9fa1f608dce7652be9a 100755

Download original patch · Release notes

Diff rows 1–61 of 61. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

test/functional/mining_basic.py CHANGED
@@ -49,7 +49,7 @@ MAX_FUTURE_BLOCK_TIME = 2 * 3600
49
49
  MAX_TIMEWARP = 600
50
50
  VERSIONBITS_TOP_BITS = 0x20000000
51
51
  VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28
52
- DEFAULT_BLOCK_MIN_TX_FEE = 1 # default `-blockmintxfee` setting [sat/kvB]
52
+ DEFAULT_BLOCK_MIN_TX_FEE = 1000 # default `-blockmintxfee` setting [sat/kvB]
53
53
 
54
54
 
55
55
  def assert_template(node, block, expect, rehash=True):
@@ -96,18 +96,18 @@ class MiningTest(BitcoinTestFramework):
96
96
 
97
97
  def test_blockmintxfee_parameter(self):
98
98
  self.log.info("Test -blockmintxfee setting")
99
- self.restart_node(0, extra_args=['-minrelaytxfee=0', '-persistmempool=0'])
99
+ self.restart_node(0, extra_args=['-blockprioritysize=0', '-minrelaytxfee=0', '-persistmempool=0'])
100
100
  node = self.nodes[0]
101
101
 
102
102
  # test default (no parameter), zero and a bunch of arbitrary blockmintxfee rates [sat/kvB]
103
- for blockmintxfee_sat_kvb in (DEFAULT_BLOCK_MIN_TX_FEE, 0, 5, 10, 50, 100, 500, 1000, 2500, 5000, 21000, 333333, 2500000):
103
+ for blockmintxfee_sat_kvb in (DEFAULT_BLOCK_MIN_TX_FEE, 0, 5, 10, 50, 100, 500, 2500, 5000, 21000, 333333, 2500000):
104
104
  blockmintxfee_btc_kvb = blockmintxfee_sat_kvb / Decimal(COIN)
105
105
  if blockmintxfee_sat_kvb == DEFAULT_BLOCK_MIN_TX_FEE:
106
106
  self.log.info(f"-> Default -blockmintxfee setting ({blockmintxfee_sat_kvb} sat/kvB)...")
107
107
  else:
108
108
  blockmintxfee_parameter = f"-blockmintxfee={blockmintxfee_btc_kvb:.8f}"
109
109
  self.log.info(f"-> Test {blockmintxfee_parameter} ({blockmintxfee_sat_kvb} sat/kvB)...")
110
- self.restart_node(0, extra_args=[blockmintxfee_parameter, '-minrelaytxfee=0', '-persistmempool=0'])
110
+ self.restart_node(0, extra_args=[blockmintxfee_parameter, '-blockprioritysize=0', '-minrelaytxfee=0', '-persistmempool=0'])
111
111
  self.wallet.rescan_utxos() # to avoid spending outputs of txs that are not in mempool anymore after restart
112
112
 
113
113
  # submit one tx with exactly the blockmintxfee rate, and one slightly below
@@ -238,7 +238,7 @@ class MiningTest(BitcoinTestFramework):
238
238
  LARGE_TXS_COUNT = 10
239
239
  LARGE_VSIZE = int(((MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT) / WITNESS_SCALE_FACTOR) / LARGE_TXS_COUNT)
240
240
  HIGH_FEERATE = Decimal("0.0003")
241
- self.restart_node(0, extra_args=[f"-datacarriersize={LARGE_VSIZE}"])
241
+ self.restart_node(0, extra_args=["-blockprioritysize=0", f"-blockmaxweight={MAX_BLOCK_WEIGHT}", f"-datacarriersize={LARGE_VSIZE}", f"-maxscriptsize={LARGE_VSIZE}"])
242
242
 
243
243
  # Ensure the mempool is empty
244
244
  assert_equal(len(self.nodes[0].getrawmempool()), 0)
@@ -266,7 +266,7 @@ class MiningTest(BitcoinTestFramework):
266
266
  # Test block template creation with custom -blockmaxweight
267
267
  custom_block_weight = MAX_BLOCK_WEIGHT - 2000
268
268
  # Reducing the weight by 2000 units will prevent 1 large transaction from fitting into the block.
269
- self.restart_node(0, extra_args=[f"-datacarriersize={LARGE_VSIZE}", f"-blockmaxweight={custom_block_weight}"])
269
+ self.restart_node(0, extra_args=["-blockprioritysize=0", f"-datacarriersize={LARGE_VSIZE}", f"-maxscriptsize={LARGE_VSIZE}", f"-blockmaxweight={custom_block_weight}"])
270
270
 
271
271
  self.log.info("Testing the block template with custom -blockmaxweight to include 9 large and 2 normal transactions.")
272
272
  self.verify_block_template(
@@ -276,7 +276,7 @@ class MiningTest(BitcoinTestFramework):
276
276
 
277
277
  # Ensure the block weight does not exceed the maximum
278
278
  self.log.info(f"Testing that the block weight will never exceed {MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT}.")
279
- self.restart_node(0, extra_args=[f"-datacarriersize={LARGE_VSIZE}", f"-blockmaxweight={MAX_BLOCK_WEIGHT}"])
279
+ self.restart_node(0, extra_args=["-blockprioritysize=0", f"-datacarriersize={LARGE_VSIZE}", f"-maxscriptsize={LARGE_VSIZE}", f"-blockmaxweight={MAX_BLOCK_WEIGHT}"])
280
280
  self.log.info("Sending 2 additional normal transactions to fill the mempool to the maximum block weight.")
281
281
  self.send_transactions(utxos[LARGE_TXS_COUNT + 2:], NORMAL_FEERATE, NORMAL_VSIZE)
282
282
  self.log.info(f"Testing that the mempool's weight matches the maximum block weight: {MAX_BLOCK_WEIGHT}.")
@@ -290,7 +290,7 @@ class MiningTest(BitcoinTestFramework):
290
290
 
291
291
  self.log.info("Test -blockreservedweight startup option.")
292
292
  # Lowering the -blockreservedweight by 4000 will allow for two more transactions.
293
- self.restart_node(0, extra_args=[f"-datacarriersize={LARGE_VSIZE}", "-blockreservedweight=4000"])
293
+ self.restart_node(0, extra_args=["-blockprioritysize=0", f"-blockmaxweight={MAX_BLOCK_WEIGHT}", f"-datacarriersize={LARGE_VSIZE}", f"-maxscriptsize={LARGE_VSIZE}", "-blockreservedweight=4000"])
294
294
  self.verify_block_template(
295
295
  expected_tx_count=12,
296
296
  expected_weight=MAX_BLOCK_WEIGHT - 4000,