From b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Fri, 17 Apr 2020 11:32:48 -0400 Subject: [PATCH] refactor: Remove g_rpc_node global This commit does not change behavior --- src/init.cpp | 1 - src/rpc/blockchain.cpp | 2 -- src/rpc/blockchain.h | 5 ----- src/test/util/setup_common.cpp | 2 -- 4 files changed, 10 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 4a12af22c34..f01416e136b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1339,7 +1339,6 @@ bool AppInitMain(const util::Ref& context, NodeContext& node) for (const auto& client : node.chain_clients) { client->registerRpcs(); } - g_rpc_node = &node; #if ENABLE_ZMQ RegisterZMQRPCCommands(tableRPC); #endif diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e5702d77e90..c04e4fc77b2 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2394,5 +2394,3 @@ static const CRPCCommand commands[] = for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); } - -NodeContext* g_rpc_node = nullptr; diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h index fec9a0d3c5f..2417340d642 100644 --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -50,11 +50,6 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex /** Used by getblockstats to get feerates at different percentiles by weight */ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector>& scores, int64_t total_weight); -//! Pointer to node state that needs to be declared as a global to be accessible -//! RPC methods. Due to limitations of the RPC framework, there's currently no -//! direct way to pass in state to RPC methods without globals. -extern NodeContext* g_rpc_node; - NodeContext& EnsureNodeContext(const util::Ref& context); CTxMemPool& EnsureMemPool(const util::Ref& context); diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 8e1c04d3c9f..86dac55b2b6 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -123,7 +123,6 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector(); @@ -176,7 +175,6 @@ TestingSetup::~TestingSetup() threadGroup.join_all(); GetMainSignals().FlushBackgroundCallbacks(); GetMainSignals().UnregisterBackgroundSignalScheduler(); - g_rpc_node = nullptr; m_node.connman.reset(); m_node.banman.reset(); m_node.args = nullptr;