diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-05-28 02:13:19 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-05-28 02:13:19 -0400 |
commit | 4a7253ab6c3bb323581cea54573529c2f823f035 (patch) | |
tree | 026a1a071a230352a7673f5be38ba1c1b8935550 /src/wallet/rpcwallet.h | |
parent | e783197bf0f7429f80fea94b44c59857bc8cfef9 (diff) | |
download | bitcoin-4a7253ab6c3bb323581cea54573529c2f823f035.tar.xz |
Remove g_rpc_chain global
Replace with RPC request reference to new WalletContext struct similar to the
existing NodeContext struct and reference.
This PR is a followup to 25ad2c623af30056ffb36dcd203a52edda2b170f
https://github.com/bitcoin/bitcoin/pull/18740 removing the g_rpc_node global.
Some later PRs will follow this up and move more wallet globals to the
WalletContext struct.
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
Diffstat (limited to 'src/wallet/rpcwallet.h')
-rw-r--r-- | src/wallet/rpcwallet.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/wallet/rpcwallet.h b/src/wallet/rpcwallet.h index fd8a41ed14..d00221a04c 100644 --- a/src/wallet/rpcwallet.h +++ b/src/wallet/rpcwallet.h @@ -16,18 +16,10 @@ class CWallet; class JSONRPCRequest; class LegacyScriptPubKeyMan; class UniValue; -struct PartiallySignedTransaction; class CTransaction; +struct PartiallySignedTransaction; +struct WalletContext; -namespace interfaces { -class Chain; -} - -//! Pointer to chain interface that needs to be declared as a global to be -//! accessible loadwallet and createwallet methods. Due to limitations of the -//! RPC framework, there's currently no direct way to pass in state to RPC -//! methods without globals. -extern interfaces::Chain* g_rpc_chain; Span<const CRPCCommand> GetWalletRPCCommands(); /** @@ -40,6 +32,7 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques void EnsureWalletIsUnlocked(const CWallet*); bool EnsureWalletIsAvailable(const CWallet*, bool avoidException); +WalletContext& EnsureWalletContext(const util::Ref& context); LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_create = false); UniValue getaddressinfo(const JSONRPCRequest& request); |