aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2018-11-27 17:54:05 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2018-11-27 17:55:01 +0000
commit29aeed1734793d4bc50174d1837393581a234ee6 (patch)
tree4094b78315382a77e91a731ad5ee7810e0a34d7a
parent8a9ffec0a257da659ba54c5073bfc820986ae9c1 (diff)
downloadbitcoin-29aeed1734793d4bc50174d1837393581a234ee6.tar.xz
Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize
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.
-rwxr-xr-xtest/functional/mempool_accept.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py
index 44426a0ff7..005fc7ed32 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,
@@ -178,7 +179,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())],