mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
Merge bitcoin/bitcoin#34136: test: Allow mempool_updatefromblock.py to run on 32-bit
fac5a1b10atest: Allow mempool_updatefromblock.py to run on 32-bit (MarcoFalke) Pull request description: The number of dropped parent transactions in the `test_max_disconnect_pool_bytes` test was hard-coded to `2`. This happens to work fine on 64-bit for now. However, it seems to fail on 32-bit (https://github.com/bitcoin/bitcoin/issues/34108). I don't think we care about the exact number, as long as it is at least `1`. So hard-code `1` for an initial sanity check, and then calculate the exact value at runtime via `len(mempool) // 2`. Also, enable the functional tests in 32-bit CI, to confirm the regression test. Fixes https://github.com/bitcoin/bitcoin/issues/34108 ACKs for top commit: bensig: ACKfac5a1b10ainstagibbs: ACKfac5a1b10aTree-SHA512: 8d468f306d95e52cbfac1803293e3b8e9575c9010200010c7833382112509e0d51827dc9681b0b68eeae742af2c14d12da5fd4cf0e1d871a02f91fc80e6720d1
This commit is contained in:
@@ -13,7 +13,7 @@ import time
|
||||
|
||||
from test_framework.blocktools import create_empty_fork
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error
|
||||
from test_framework.util import assert_equal, assert_greater_than_or_equal, assert_raises_rpc_error
|
||||
from test_framework.wallet import MiniWallet
|
||||
from test_framework.mempool_util import DEFAULT_CLUSTER_LIMIT
|
||||
|
||||
@@ -161,12 +161,17 @@ class MempoolUpdateFromBlockTest(BitcoinTestFramework):
|
||||
# but not all, and any time parent is dropped, child is also removed
|
||||
self.trigger_reorg(fork_blocks=fork_blocks)
|
||||
mempool = self.nodes[0].getrawmempool()
|
||||
expected_parent_count = len(large_std_txs) - 2
|
||||
assert_equal(len(mempool), expected_parent_count * 2)
|
||||
# At least one parent must be dropped, but more may be dropped,
|
||||
# depending on the dynamic cost overhead.
|
||||
expected_parent_count = len(large_std_txs) - 1
|
||||
assert_greater_than_or_equal(expected_parent_count * 2, len(mempool))
|
||||
expected_parent_count = len(mempool) // 2
|
||||
|
||||
parent_presence = [tx["txid"] in mempool for tx in large_std_txs]
|
||||
|
||||
# The txns at the end of the list, or most recently confirmed, should have been trimmed
|
||||
assert_equal([tx["txid"] in mempool for tx in large_std_txs], [tx["txid"] in mempool for tx in small_child_txs])
|
||||
assert_equal([tx["txid"] in mempool for tx in large_std_txs], [True] * expected_parent_count + [False] * 2)
|
||||
assert_equal(parent_presence, [tx["txid"] in mempool for tx in small_child_txs])
|
||||
assert_equal(parent_presence, [True] * expected_parent_count + [False] * (len(large_std_txs) - expected_parent_count))
|
||||
|
||||
def test_chainlimits_exceeded(self):
|
||||
self.log.info('Check that too long chains on reorg are handled')
|
||||
|
||||
Reference in New Issue
Block a user