Skip to content

Commit 29aeed1

Browse files
committed
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.
1 parent 8a9ffec commit 29aeed1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/functional/mempool_accept.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""Test mempool acceptance of raw transactions."""
66

77
from io import BytesIO
8+
import math
89
from test_framework.test_framework import BitcoinTestFramework
910
from test_framework.messages import (
1011
BIP125_SEQUENCE_NUMBER,
@@ -178,7 +179,7 @@ def run_test(self):
178179

179180
self.log.info('A really large transaction')
180181
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
181-
tx.vin = [tx.vin[0]] * (MAX_BLOCK_BASE_SIZE // len(tx.vin[0].serialize()))
182+
tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_BASE_SIZE / len(tx.vin[0].serialize()))
182183
self.check_mempool_result(
183184
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-oversize'}],
184185
rawtxs=[bytes_to_hex_str(tx.serialize())],

0 commit comments

Comments
 (0)