tests: log node JSON-RPC errors during test setup
What changed, and why it matters
This commit only improves error messages in Bitcoin Core's internal test framework. When a test setup step fails because the node returns a JSON-RPC error, the test runner now logs the actual error details and HTTP status code instead of a generic 'Unexpected exception' message. There is no change to production Bitcoin node code, no security fix, and no vulnerability.
No security action needed. This is a test-framework logging improvement; review and merge as normal code quality change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds a specific JSONRPCException handler in test_framework.py’s setup() method, before the existing BaseException catch-all. It logs e.error and e.http_status and marks the test as failed. This is purely a diagnostic improvement for the functional test suite; it does not alter consensus, networking, wallet, or RPC behavior of bitcoind itself.
Changed components
test/functional/test_framework/test_framework.pyInspect captured patch +3 / −0
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 1f957564..3ab351ae 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -147,6 +147,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
except subprocess.CalledProcessError as e:
self.log.exception(f"Called Process failed with stdout='{e.stdout}'; stderr='{e.stderr}';")
self.success = TestStatus.FAILED
+ except JSONRPCException as e:
+ self.log.exception(f"Failure during setup: error={e.error}, http_status={e.http_status}")
+ self.success = TestStatus.FAILED
except BaseException:
self.log.exception("Unexpected exception")
self.success = TestStatus.FAILED
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.