diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-08-02 15:51:42 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-08-02 15:51:48 +0200 |
commit | b620b2d58a55a88ad21da70cb2000863ef17b651 (patch) | |
tree | 24fa86663596ffc6de09f53d7f00168fc9ea0fd1 /test/functional/mempool_accept.py | |
parent | dcd116950fed0890020bc7283c5fa753f866047f (diff) | |
parent | 607076d01bf23c69ac21950c17b01fb4e1130774 (diff) |
Merge bitcoin/bitcoin#22378: test: remove confusing `MAX_BLOCK_BASE_SIZE`
607076d01bf23c69ac21950c17b01fb4e1130774 test: remove confusing `MAX_BLOCK_BASE_SIZE` (Sebastian Falbesoner)
4af97c74edcda56cd15523bf3a335adea2bad14a test: introduce `get_weight()` helper for CBlock (Sebastian Falbesoner)
a084ebe1330bcec15715e08b0f65319142927ad1 test: introduce `get_weight()` helper for CTransaction (Sebastian Falbesoner)
Pull request description:
This is a very late follow-up PR to #10618, which removed the constant `MAX_BLOCK_BASE_SIZE` from the core implementation about four years ago (see also #10608 in why it was considered confusing and superfluous).
Since there is also no point in still keeping it in the functional test framework, the PR switches to weight-based accounting on the relevant test code parts and use `MAX_BLOCK_WEIGHT` instead for the block limit checks. To prepare that, the first two commits introduce `get_weight()` helpers for the classes CTransaction and CBlock, respectively.
ACKs for top commit:
MarcoFalke:
review ACK 607076d01bf23c69ac21950c17b01fb4e1130774 🚴
Tree-SHA512: d59aa0b6b3dfd0a849b8063e66de275d252f705f99e25cd3bf6daec028b47d946777ee5b42a060f5283cb18e917ac073119c2c0e11bbc21211f69ef0a6ed335a
Diffstat (limited to 'test/functional/mempool_accept.py')
-rwxr-xr-x | test/functional/mempool_accept.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index 60c0953f6f..97d29ff197 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -15,7 +15,7 @@ from test_framework.messages import ( COutPoint, CTxIn, CTxOut, - MAX_BLOCK_BASE_SIZE, + MAX_BLOCK_WEIGHT, MAX_MONEY, tx_from_hex, ) @@ -209,7 +209,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): self.log.info('A really large transaction') tx = tx_from_hex(raw_tx_reference) - tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_BASE_SIZE / len(tx.vin[0].serialize())) + tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_WEIGHT // 4 / len(tx.vin[0].serialize())) self.check_mempool_result( result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-oversize'}], rawtxs=[tx.serialize().hex()], |