diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-11-28 10:40:29 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-11-28 10:40:33 -0500 |
commit | 9ebfe0e927374a5e5b5271b105be40b227980752 (patch) | |
tree | 4f9e8d7535a8a36caae98bdcd4560d07e67c5744 /test/functional | |
parent | 600b85bb417295f4d9c7d5b9fd8502f3c8f113e3 (diff) | |
parent | 29aeed1734793d4bc50174d1837393581a234ee6 (diff) |
Merge #14819: Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize
29aeed1734 Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize (Luke Dashjr)
Pull request description:
Simply integer dividing results in an acceptable size if the limit isn't an exact multiple of the input size.
Use math.ceil to ensure the transaction is always oversize.
(This issue can be triggered by changing the address style used.)
Tree-SHA512: e45062b0e8a3e9cb08e9dac5275b68d86e4377b460f1b3b995944090a055b0542a6986826312ec0e223369838094e42e20d8614b5c2bab9975b9a6f749295b21
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/mempool_accept.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index 8847777ba7..bec6a0050a 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -5,6 +5,7 @@ """Test mempool acceptance of raw transactions.""" from io import BytesIO +import math from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import ( BIP125_SEQUENCE_NUMBER, @@ -181,7 +182,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): self.log.info('A really large transaction') tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference))) - tx.vin = [tx.vin[0]] * (MAX_BLOCK_BASE_SIZE // len(tx.vin[0].serialize())) + tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_BASE_SIZE / len(tx.vin[0].serialize())) self.check_mempool_result( result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-oversize'}], rawtxs=[bytes_to_hex_str(tx.serialize())], |