mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
refactor: Pass NodeContext to RPC and REST methods through util::Ref
This commit does not change behavior
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <interfaces/chain.h>
|
||||
#include <node/context.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/ref.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
@@ -19,13 +20,20 @@
|
||||
|
||||
#include <rpc/blockchain.h>
|
||||
|
||||
UniValue CallRPC(std::string args)
|
||||
class RPCTestingSetup : public TestingSetup
|
||||
{
|
||||
public:
|
||||
UniValue CallRPC(std::string args);
|
||||
};
|
||||
|
||||
UniValue RPCTestingSetup::CallRPC(std::string args)
|
||||
{
|
||||
std::vector<std::string> vArgs;
|
||||
boost::split(vArgs, args, boost::is_any_of(" \t"));
|
||||
std::string strMethod = vArgs[0];
|
||||
vArgs.erase(vArgs.begin());
|
||||
JSONRPCRequest request;
|
||||
util::Ref context{m_node};
|
||||
JSONRPCRequest request(context);
|
||||
request.strMethod = strMethod;
|
||||
request.params = RPCConvertValues(strMethod, vArgs);
|
||||
request.fHelp = false;
|
||||
@@ -40,7 +48,7 @@ UniValue CallRPC(std::string args)
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(rpc_tests, TestingSetup)
|
||||
BOOST_FIXTURE_TEST_SUITE(rpc_tests, RPCTestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(rpc_rawparams)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user