Create a block template and check that it satisfies the expected transaction count and total weight.
(self, expected_tx_count, expected_weight)
| 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.") |