diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-09-17 19:05:26 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-10-28 10:30:51 -0400 |
commit | 362ded410b8cb1104b7ef31ff8488fec4824a7d5 (patch) | |
tree | 0ffc9c199a3b7adcb9957b19824bff8c0fe33bb0 /src/interfaces | |
parent | 8922d7f6b751a3e6b3b9f6fb7961c442877fb65a (diff) |
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.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/wallet.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 9b0a8b64c9..bdfb17801d 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -489,7 +489,11 @@ public: : m_chain(chain), m_wallet_filenames(std::move(wallet_filenames)) { } - void registerRpcs() override { return RegisterWalletRPCCommands(m_chain, m_rpc_handlers); } + void registerRpcs() override + { + g_rpc_chain = &m_chain; + return RegisterWalletRPCCommands(m_chain, m_rpc_handlers); + } bool verify() override { return VerifyWallets(m_chain, m_wallet_filenames); } bool load() override { return LoadWallets(m_chain, m_wallet_filenames); } void start(CScheduler& scheduler) override { return StartWallets(scheduler); } |