mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
bitcoin-cli: use json-rpc 2.0
This commit is contained in:
parent
d39bdf3397
commit
391843b029
@ -298,7 +298,7 @@ public:
|
||||
}
|
||||
addresses.pushKV("total", total);
|
||||
result.pushKV("addresses_known", std::move(addresses));
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V1_LEGACY);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V2);
|
||||
}
|
||||
};
|
||||
|
||||
@ -367,7 +367,7 @@ public:
|
||||
}
|
||||
result.pushKV("relayfee", batch[ID_NETWORKINFO]["result"]["relayfee"]);
|
||||
result.pushKV("warnings", batch[ID_NETWORKINFO]["result"]["warnings"]);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V1_LEGACY);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V2);
|
||||
}
|
||||
};
|
||||
|
||||
@ -622,7 +622,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return JSONRPCReplyObj(UniValue{result}, NullUniValue, /*id=*/1, JSONRPCVersion::V1_LEGACY);
|
||||
return JSONRPCReplyObj(UniValue{result}, NullUniValue, /*id=*/1, JSONRPCVersion::V2);
|
||||
}
|
||||
|
||||
const std::string m_help_doc{
|
||||
@ -709,7 +709,7 @@ public:
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("address", address_str);
|
||||
result.pushKV("blocks", reply.get_obj()["result"]);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V1_LEGACY);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, /*id=*/1, JSONRPCVersion::V2);
|
||||
}
|
||||
protected:
|
||||
std::string address_str;
|
||||
|
@ -45,6 +45,7 @@ UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params,
|
||||
request.pushKV("method", strMethod);
|
||||
request.pushKV("params", params);
|
||||
request.pushKV("id", id);
|
||||
request.pushKV("jsonrpc", "2.0");
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ enum class JSONRPCVersion {
|
||||
V2
|
||||
};
|
||||
|
||||
/** JSON-RPC 2.0 request, only used in bitcoin-cli **/
|
||||
UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
|
||||
UniValue JSONRPCReplyObj(UniValue result, UniValue error, std::optional<UniValue> id, JSONRPCVersion jsonrpc_version);
|
||||
UniValue JSONRPCError(int code, const std::string& message);
|
||||
|
Loading…
Reference in New Issue
Block a user