test: Allow mempool_updatefromblock.py to run on 32-bit
What changed, and why it matters
This commit only changes a test script and a CI configuration file. It makes a functional test more tolerant of minor differences on 32-bit ARM systems and enables functional tests to run in the ARM CI environment. There is no change to the actual Bitcoin node software that users run, so it cannot affect live funds, network consensus, or node security.
No security action needed. Treat as a normal test/CI maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies test/functional/mempool_updatefromblock.py to relax an exact-count assertion about how many transactions remain in the mempool after a reorg, replacing it with a greater-than-or-equal check and deriving the expected count from the actual mempool size. It also removes RUN_UNIT_TESTS=true and RUN_FUNCTIONAL_TESTS=false overrides from ci/test/00_setup_env_arm.sh so the default test suite runs on ARM. These are test-framework/CI adjustments only; no consensus, networking, wallet, or mempool production code is touched.
Changed components
test/functional/mempool_updatefromblock.pyci/test/00_setup_env_arm.shInspect captured patch +10 / −7
diff --git a/ci/test/00_setup_env_arm.sh b/ci/test/00_setup_env_arm.sh
index c410a80d..0d05877b 100755
--- a/ci/test/00_setup_env_arm.sh
+++ b/ci/test/00_setup_env_arm.sh
@@ -12,8 +12,6 @@ export PACKAGES="python3-zmq g++-arm-linux-gnueabihf libc6:armhf libstdc++6:armh
export CONTAINER_NAME=ci_arm_linux
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" # Check that https://packages.ubuntu.com/noble/g++-arm-linux-gnueabihf (version 13.x, similar to guix) can cross-compile
export CI_IMAGE_PLATFORM="linux/arm64"
-export RUN_UNIT_TESTS=true
-export RUN_FUNCTIONAL_TESTS=false
export GOAL="install"
export CI_LIMIT_STACK_SIZE=1
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
diff --git a/test/functional/mempool_updatefromblock.py b/test/functional/mempool_updatefromblock.py
index 3a201ae4..11571f6f 100755
--- a/test/functional/mempool_updatefromblock.py
+++ b/test/functional/mempool_updatefromblock.py
@@ -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')
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.