Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 2: [PATCH 02/17] feat(policy): preserve Roots parsing and local transaction checks

test/functional/mining_basic.py

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

File metadata
index 750dd42c53ef4ea2f68e60ee4c3a05880cbca137..9992786d34cf51f925a57fb3c901b37de4fedfeb 100755

Download original patch · Release notes

Diff rows 1–73 of 73. 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
@@ -61,10 +61,12 @@ class MiningTest(BitcoinTestFramework):
61
61
  def set_test_params(self):
62
62
  self.num_nodes = 3
63
63
  self.extra_args = [
64
- [],
64
+ ["-permitbarepubkey=1"],
65
65
  [],
66
66
  ["-fastprune", "-prune=1"]
67
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]
68
70
  self.setup_clean_chain = True
69
71
 
70
72
  def mine_chain(self):
@@ -78,10 +80,10 @@ class MiningTest(BitcoinTestFramework):
78
80
  assert_equal(mining_info['currentblockweight'], DEFAULT_BLOCK_RESERVED_WEIGHT)
79
81
 
80
82
  self.log.info('test blockversion')
81
- self.restart_node(0, extra_args=[f'-mocktime={t}', '-blockversion=1337'])
83
+ self.restart_node(0, extra_args=self.extra_args[0] + [f'-mocktime={t}', '-blockversion=1337'])
82
84
  self.connect_nodes(0, 1)
83
85
  assert_equal(1337, self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
84
- self.restart_node(0, extra_args=[f'-mocktime={t}'])
86
+ self.restart_node(0, extra_args=self.extra_args[0] + [f'-mocktime={t}'])
85
87
  self.connect_nodes(0, 1)
86
88
  assert_equal(VERSIONBITS_TOP_BITS + (1 << VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT), self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)['version'])
87
89
  self.restart_node(0)
@@ -140,7 +142,7 @@ class MiningTest(BitcoinTestFramework):
140
142
 
141
143
  def test_blockmintxfee_parameter(self):
142
144
  self.log.info("Test -blockmintxfee setting")
143
- self.restart_node(0, extra_args=['-minrelaytxfee=0', '-persistmempool=0'])
145
+ self.restart_node(0, extra_args=self.extra_args[0] + ['-minrelaytxfee=0', '-persistmempool=0'])
144
146
  node = self.nodes[0]
145
147
 
146
148
  # test default (no parameter), zero and a bunch of arbitrary blockmintxfee rates [sat/kvB]
@@ -151,7 +153,7 @@ class MiningTest(BitcoinTestFramework):
151
153
  else:
152
154
  blockmintxfee_parameter = f"-blockmintxfee={blockmintxfee_btc_kvb:.8f}"
153
155
  self.log.info(f"-> Test {blockmintxfee_parameter} ({blockmintxfee_sat_kvb} sat/kvB)...")
154
- self.restart_node(0, extra_args=[blockmintxfee_parameter, '-minrelaytxfee=0', '-persistmempool=0'])
156
+ self.restart_node(0, extra_args=self.extra_args[0] + [blockmintxfee_parameter, '-minrelaytxfee=0', '-persistmempool=0'])
155
157
  assert_equal(node.getmininginfo()['blockmintxfee'], blockmintxfee_btc_kvb)
156
158
 
157
159
  # submit one tx with exactly the blockmintxfee rate, and one slightly below
@@ -193,7 +195,7 @@ class MiningTest(BitcoinTestFramework):
193
195
  def test_timewarp(self):
194
196
  self.log.info("Test timewarp attack mitigation (BIP94)")
195
197
  node = self.nodes[0]
196
- self.restart_node(0, extra_args=['-test=bip94'])
198
+ self.restart_node(0, extra_args=self.extra_args[0] + ['-test=bip94'])
197
199
 
198
200
  self.log.info("Mine until the last block of the retarget period")
199
201
  blockchain_info = self.nodes[0].getblockchaininfo()
@@ -318,7 +320,7 @@ class MiningTest(BitcoinTestFramework):
318
320
  # Test block template creation with custom -blockmaxweight
319
321
  custom_block_weight = MAX_BLOCK_WEIGHT - 2000
320
322
  # Reducing the weight by 2000 units will prevent 1 large transaction from fitting into the block.
321
- self.restart_node(0, extra_args=[f"-blockmaxweight={custom_block_weight}"])
323
+ self.restart_node(0, extra_args=self.extra_args[0] + [f"-blockmaxweight={custom_block_weight}"])
322
324
 
323
325
  self.log.info("Testing the block template with custom -blockmaxweight to include 9 large and 2 normal transactions.")
324
326
  self.verify_block_template(
@@ -328,7 +330,7 @@ class MiningTest(BitcoinTestFramework):
328
330
 
329
331
  # Ensure the block weight does not exceed the maximum
330
332
  self.log.info(f"Testing that the block weight will never exceed {MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT}.")
331
- self.restart_node(0, extra_args=[f"-blockmaxweight={MAX_BLOCK_WEIGHT}"])
333
+ self.restart_node(0, extra_args=self.extra_args[0] + [f"-blockmaxweight={MAX_BLOCK_WEIGHT}"])
332
334
  self.log.info("Sending 2 additional normal transactions to fill the mempool to the maximum block weight.")
333
335
  self.send_transactions(utxos[LARGE_TXS_COUNT + 2:], NORMAL_FEERATE, NORMAL_VSIZE)
334
336
  self.log.info(f"Testing that the mempool's weight matches the maximum block weight: {MAX_BLOCK_WEIGHT}.")
@@ -342,7 +344,7 @@ class MiningTest(BitcoinTestFramework):
342
344
 
343
345
  self.log.info("Test -blockreservedweight startup option.")
344
346
  # Lowering the -blockreservedweight by 4000 will allow for two more transactions.
345
- self.restart_node(0, extra_args=["-blockreservedweight=4000"])
347
+ self.restart_node(0, extra_args=self.extra_args[0] + ["-blockreservedweight=4000"])
346
348
  self.verify_block_template(
347
349
  expected_tx_count=12,
348
350
  expected_weight=MAX_BLOCK_WEIGHT - 4000,