test: fix send_batch_request to pass callables when using --usecli
What changed, and why it matters
This is a minor fix to a Bitcoin Core functional test script. It changes how test batch RPC requests are built so they work correctly when tests are run with the --usecli option. There is no change to production code, no security vulnerability, and no risk to real Bitcoin nodes or wallets.
No security action needed. This is a test-only quality fix. Reviewers can treat it as ordinary test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/feature_index_prune.py. The helper send_batch_request() previously constructed raw JSON-RPC request dicts without a jsonrpc version field. Core treated these as JSON-RPC 1.0 requests. That worked for the normal AuthServiceProxy path but failed with –usecli because TestNodeCLI.batch() expects callable proxy objects. The fix uses get_request() on the node method proxy, which is available in both AuthServiceProxy and TestNodeCLIAttr. Because get_request() produces JSON-RPC 2.0 requests, responses no longer contain an error key when successful, so the assertion is updated to check absence of error rather than error being None.
Changed components
test/functional/feature_index_prune.pyInspect captured patch +2 / −2
diff --git a/test/functional/feature_index_prune.py b/test/functional/feature_index_prune.py
index 49520be0..0654e04f 100755
--- a/test/functional/feature_index_prune.py
+++ b/test/functional/feature_index_prune.py
@@ -18,11 +18,11 @@ from typing import List, Any
def send_batch_request(node: TestNode, method: str, params: List[Any]) -> List[Any]:
"""Send batch request and parse all results"""
- data = [{"method": method, "params": p} for p in params]
+ data = [getattr(node, method).get_request(*p) for p in params]
response = node.batch(data)
result = []
for item in response:
- assert item["error"] is None, item["error"]
+ assert "error" not in item, item["error"]
result.append(item["result"])
return result
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.