[Question]
Hi, I'd like to call RPC programmatically, instead of using bitcoin-cli. when I call the function RPCConvertValues() , it always raise error
RPCConvertValues() is defined here : https://github.com/bitcoin/bitcoin/blob/cab94cc07489f704c4b95171b23be0e8025df794/src/rpc/client.cpp#L221
test code are here : https://github.com/bitcoin/bitcoin/blob/46fc4d1a24c88e797d6080336e3828e45e39c3fd/src/test/rpc_tests.cpp#L319 https://github.com/bitcoin/bitcoin/blob/7967104aee055476107dc17265cefc4ae4e75378/src/bitcoin-cli.cpp#L293 https://github.com/bitcoin/bitcoin/blob/eb292af309aa57f3d7998b01307dd4cb91702908/src/qt/rpcconsole.cpp#L302
My test code :
#include <iostream>
#include <rpc/blockchain.cpp>
#include <rpc/request.h>
#include <rpc/client.h>
#include <rpc/util.h>
#include <univalue/include/univalue.h>
#include <interfaces/node.h>
namespace experimental {
void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); }
void rpcgetblockhash() {
wait(30);
std::cout << "getblockhash RPC CALL!!" << std::endl;
interfaces::Node* node;
UniValue params = RPCConvertValues("getblockhash", {"0"}); // occurred error
}
}
Occurred error : <img width="1375" alt="스크린샷 2019-12-02 오전 1 11 05" src="https://user-images.githubusercontent.com/12508269/69916639-b576b500-14a0-11ea-8dc8-a4cad816e31c.png">
I think that both are same between my function call form and function form of specified link above. I don't know why I'm getting error. can you give some guide?