Skip to content

Commit 9ebfe0e

Browse files
author
MarcoFalke
committed
Merge #14819: Bugfix: test/functional/mempool_accept: Ensure oversize transaction is actually oversize
29aeed1 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
2 parents 600b85b + 29aeed1 commit 9ebfe0e

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,
@@ -181,7 +182,7 @@ def run_test(self):
181182

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

0 commit comments

Comments
 (0)