test: Add missing txospenderindex coverage in feature_init
What changed, and why it matters
This is a routine test-only change for Bitcoin Core. It adds the new '-txospenderindex' option to an existing initialization test and refactors the list of index arguments into a shared constant. There is no change to production code, no security fix, and no vulnerability.
No security action required. Treat as normal test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/feature_init.py only. It introduces an ALL_INDEX_ARGS constant containing ‘-txindex=1’, ‘-blockfilterindex=1’, ‘-coinstatsindex=1’, and ‘-txospenderindex=1’, replaces duplicated argument lists, adds ‘txospenderindex thread start’ to the expected debug-log lines during startup, and uses ALL_INDEX_ARGS in the index-removal/perturbation tests. The previous code omitted ‘-txospenderindex=1’ in some test paths, so this is test-coverage completion, not a security patch.
Changed components
test/functional/feature_init.pyInspect captured patch +12 / −7
diff --git a/test/functional/feature_init.py b/test/functional/feature_init.py
index 733f5188..05a939c2 100755
--- a/test/functional/feature_init.py
+++ b/test/functional/feature_init.py
@@ -18,6 +18,12 @@ from test_framework.test_node import (
)
from test_framework.util import assert_equal
+ALL_INDEX_ARGS = [
+ '-txindex=1',
+ '-blockfilterindex=1',
+ '-coinstatsindex=1',
+ '-txospenderindex=1',
+]
class InitTest(BitcoinTestFramework):
"""
@@ -74,6 +80,7 @@ class InitTest(BitcoinTestFramework):
b'txindex thread start',
b'block filter index thread start',
b'coinstatsindex thread start',
+ b'txospenderindex thread start',
b'msghand thread start',
b'net thread start',
b'addcon thread start',
@@ -81,22 +88,21 @@ class InitTest(BitcoinTestFramework):
if self.is_wallet_compiled():
lines_to_terminate_after.append(b'Verifying wallet')
- args = ['-txindex=1', '-blockfilterindex=1', '-coinstatsindex=1', '-txospenderindex=1']
for terminate_line in lines_to_terminate_after:
self.log.info(f"Starting node and will terminate after line {terminate_line}")
with node.busy_wait_for_debug_log([terminate_line]):
if platform.system() == 'Windows':
# CREATE_NEW_PROCESS_GROUP is required in order to be able
# to terminate the child without terminating the test.
- node.start(extra_args=args, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
+ node.start(extra_args=ALL_INDEX_ARGS, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
else:
- node.start(extra_args=args)
+ node.start(extra_args=ALL_INDEX_ARGS)
self.log.debug("Terminating node after terminate line was found")
sigterm_node()
# Prior to deleting/perturbing index files, start node with all indexes enabled.
# 'check_clean_start' will ensure indexes are synchronized (i.e., data exists to modify)
- self.check_clean_start(node, args)
+ self.check_clean_start(node, ALL_INDEX_ARGS)
self.stop_node(0)
def init_stress_test_removals(self):
@@ -105,7 +111,6 @@ class InitTest(BitcoinTestFramework):
"""
self.log.info("Test startup errors after removing certain essential files")
node = self.nodes[0]
- args = ['-txindex=1', '-blockfilterindex=1', '-coinstatsindex=1']
def start_expecting_error(err_fragment, args):
node.assert_start_raises_init_error(
@@ -209,7 +214,7 @@ class InitTest(BitcoinTestFramework):
self.log.debug(f"Restoring file from {bak_path} and restarting")
Path(bak_path).rename(target_file)
- self.check_clean_start(node, args)
+ self.check_clean_start(node, ALL_INDEX_ARGS)
self.stop_node(0)
self.log.info("Test startup errors after perturbing certain essential files")
@@ -313,7 +318,7 @@ class InitTest(BitcoinTestFramework):
self.log.info("Test that stopping and restarting a node that has done nothing is not causing a failure")
options = [
[],
- ["-txindex=1", "-blockfilterindex=1", "-coinstatsindex=1"],
+ ALL_INDEX_ARGS,
]
for option in options:
self.restart_node(1, option)
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.