Skip to content

Commit b3f7f37

Browse files
committed
refactor: Remove g_rpc_node global
This commit does not change behavior
1 parent ccb5059 commit b3f7f37

File tree

4 files changed

+0
-10
lines changed

4 files changed

+0
-10
lines changed

src/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,6 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
13391339
for (const auto& client : node.chain_clients) {
13401340
client->registerRpcs();
13411341
}
1342-
g_rpc_node = &node;
13431342
#if ENABLE_ZMQ
13441343
RegisterZMQRPCCommands(tableRPC);
13451344
#endif

src/rpc/blockchain.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,5 +2394,3 @@ static const CRPCCommand commands[] =
23942394
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
23952395
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
23962396
}
2397-
2398-
NodeContext* g_rpc_node = nullptr;

src/rpc/blockchain.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
5050
/** Used by getblockstats to get feerates at different percentiles by weight */
5151
void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_weight);
5252

53-
//! Pointer to node state that needs to be declared as a global to be accessible
54-
//! RPC methods. Due to limitations of the RPC framework, there's currently no
55-
//! direct way to pass in state to RPC methods without globals.
56-
extern NodeContext* g_rpc_node;
57-
5853
NodeContext& EnsureNodeContext(const util::Ref& context);
5954
CTxMemPool& EnsureMemPool(const util::Ref& context);
6055

src/test/util/setup_common.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
123123
const CChainParams& chainparams = Params();
124124
// Ideally we'd move all the RPC tests to the functional testing framework
125125
// instead of unit tests, but for now we need these here.
126-
g_rpc_node = &m_node;
127126
RegisterAllCoreRPCCommands(tableRPC);
128127

129128
m_node.scheduler = MakeUnique<CScheduler>();
@@ -176,7 +175,6 @@ TestingSetup::~TestingSetup()
176175
threadGroup.join_all();
177176
GetMainSignals().FlushBackgroundCallbacks();
178177
GetMainSignals().UnregisterBackgroundSignalScheduler();
179-
g_rpc_node = nullptr;
180178
m_node.connman.reset();
181179
m_node.banman.reset();
182180
m_node.args = nullptr;

0 commit comments

Comments
 (0)