aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-06-12 18:28:22 -0400
committerAndrew Chow <github@achow101.com>2023-06-12 18:34:42 -0400
commitd80348ccb65601d19b4b408d442e0999b5a6cf98 (patch)
treef7d80ed4a93090c6563414b94ea55a99195f78b8 /src
parentc92fd638860c5b4477851fb3790bc8068f808d3e (diff)
parent7d452d826a7056411077b870efc3872bb2fa45e4 (diff)
downloadbitcoin-d80348ccb65601d19b4b408d442e0999b5a6cf98.tar.xz
Merge bitcoin/bitcoin#27853: rest: bugfix, fix crash error when calling `/deploymentinfo`
7d452d826a7056411077b870efc3872bb2fa45e4 test: add coverage for `/deploymentinfo` passing a blockhash (brunoerg) ce887eaf4917c337b21aa2e7811804ce003d36be rest: bugfix, fix crash error when calling `/deploymentinfo` (brunoerg) Pull request description: Calling `/deploymentinfo` passing a valid blockhash makes bitcoind to crash. It happens because we're pushing a JSON value of type array when it expects type object. See: ```cpp jsonRequest.params = UniValue(UniValue::VARR); ``` ```cpp jsonRequest.params.pushKV("blockhash", hash_str); ``` This PR fixes it by changing `pushKV` to `push_back` and adds more test coverage. ACKs for top commit: achow101: ACK 7d452d826a7056411077b870efc3872bb2fa45e4 stickies-v: ACK 7d452d826a7056411077b870efc3872bb2fa45e4 Tree-SHA512: f01551e556aba2380c3eaed0bc59057304302c202d317d7c1eec5f7ef839851f672aed80819a8719cb1cbbad2aad735d6d44314ac7d6d98bff8217f5a16c312b
Diffstat (limited to 'src')
-rw-r--r--src/rest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rest.cpp b/src/rest.cpp
index c9e61d70bd..ba149c1a9e 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -627,7 +627,7 @@ static bool rest_deploymentinfo(const std::any& context, HTTPRequest* req, const
return RESTERR(req, HTTP_BAD_REQUEST, "Block not found");
}
- jsonRequest.params.pushKV("blockhash", hash_str);
+ jsonRequest.params.push_back(hash_str);
}
req->WriteHeader("Content-Type", "application/json");