mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Avoid using g_rpc_node global in wallet code
Wallet code should use interfaces::Chain and not directly access to node state. Add a g_rpc_chain replacement global for wallet code to use, and move g_rpc_node definition to a libbitcoin_server source file so there are link errors if wallet code tries to access it.
This commit is contained in:
parent
8922d7f6b7
commit
362ded410b
10 changed files with 28 additions and 12 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <net.h>
|
||||
#include <noui.h>
|
||||
#include <pow.h>
|
||||
#include <rpc/blockchain.h>
|
||||
#include <rpc/register.h>
|
||||
#include <rpc/server.h>
|
||||
#include <script/sigcache.h>
|
||||
|
|
@ -76,6 +77,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
|
|||
const CChainParams& chainparams = Params();
|
||||
// Ideally we'd move all the RPC tests to the functional testing framework
|
||||
// instead of unit tests, but for now we need these here.
|
||||
g_rpc_node = &m_node;
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
|
||||
// We have to run a scheduler thread to prevent ActivateBestChain
|
||||
|
|
@ -114,6 +116,7 @@ TestingSetup::~TestingSetup()
|
|||
threadGroup.join_all();
|
||||
GetMainSignals().FlushBackgroundCallbacks();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
g_rpc_node = nullptr;
|
||||
m_node.connman.reset();
|
||||
m_node.banman.reset();
|
||||
UnloadBlockIndex();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue