MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / verify_block_template

Method verify_block_template

test/functional/mining_basic.py:283–291  ·  view source on GitHub ↗

Create a block template and check that it satisfies the expected transaction count and total weight.

(self, expected_tx_count, expected_weight)

Source from the content-addressed store, hash-verified

281 )
282
283 def verify_block_template(self, expected_tx_count, expected_weight):
284 """
285 Create a block template and check that it satisfies the expected transaction count and total weight.
286 """
287 response = self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
288 self.log.info(f"Testing block template: contains {expected_tx_count} transactions, and total weight <= {expected_weight}")
289 assert_equal(len(response["transactions"]), expected_tx_count)
290 total_weight = sum(transaction["weight"] for transaction in response["transactions"])
291 assert_greater_than_or_equal(expected_weight, total_weight)
292
293 def test_block_max_weight(self):
294 self.log.info("Testing default and custom -blockmaxweight startup options.")

Callers 1

test_block_max_weightMethod · 0.95

Calls 3

assert_equalFunction · 0.90
infoMethod · 0.80

Tested by 1

test_block_max_weightMethod · 0.76