We don’t do any named argument transformation when calling getdeploymentinfo().HandleRequest(jsonRequest)
directly, so the jsonRequest
is passed as is. If you look at the implementation of getdeploymentinfo()
, you’ll see it fetches the argument by position: request.params[0]
.
Even though this implementation works, it’s pretty fragile: it would also work if you’d used jsonRequest.params.pushKV("not-a-blockhash", hash_str);
, for example.
I think sticking to a VARR
is best:
0diff --git a/src/rest.cpp b/src/rest.cpp
1index 580511b9c..ba149c1a9 100644
2--- a/src/rest.cpp
3+++ b/src/rest.cpp
4@@ -613,7 +613,7 @@ static bool rest_deploymentinfo(const std::any& context, HTTPRequest* req, const
5 case RESTResponseFormat::JSON: {
6 JSONRPCRequest jsonRequest;
7 jsonRequest.context = context;
8- jsonRequest.params = UniValue(UniValue::VOBJ);
9+ jsonRequest.params = UniValue(UniValue::VARR);
10
11 if (!hash_str.empty()) {
12 uint256 hash;
13@@ -627,7 +627,7 @@ static bool rest_deploymentinfo(const std::any& context, HTTPRequest* req, const
14 return RESTERR(req, HTTP_BAD_REQUEST, "Block not found");
15 }
16
17- jsonRequest.params.pushKV("blockhash", hash_str);
18+ jsonRequest.params.push_back(hash_str);
19 }
20
21 req->WriteHeader("Content-Type", "application/json");