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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

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