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 | e783197bf0f7429f80fea94b44c59857bc8cfef9 (patch) | |
tree | fe3756424868d395910d5cb529ea490fb37a9299 /src/wallet | |
parent | 55b4c65bd1d829e799db7fe75fab88691830de43 (diff) | |
download | bitcoin-e783197bf0f7429f80fea94b44c59857bc8cfef9.tar.xz |
refactor: replace RegisterWalletRPCCommands with GetWalletRPCCommands
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 6 | ||||
-rw-r--r-- | src/wallet/rpcwallet.h | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2a9ac189ea..c4052d67b0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4263,7 +4263,7 @@ UniValue removeprunedfunds(const JSONRPCRequest& request); UniValue importmulti(const JSONRPCRequest& request); UniValue importdescriptors(const JSONRPCRequest& request); -void RegisterWalletRPCCommands(interfaces::Chain& chain, std::vector<std::unique_ptr<interfaces::Handler>>& handlers) +Span<const CRPCCommand> GetWalletRPCCommands() { // clang-format off static const CRPCCommand commands[] = @@ -4329,9 +4329,7 @@ static const CRPCCommand commands[] = { "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} }, }; // clang-format on - - for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) - handlers.emplace_back(chain.handleRpc(commands[vcidx])); + return MakeSpan(commands); } interfaces::Chain* g_rpc_chain = nullptr; diff --git a/src/wallet/rpcwallet.h b/src/wallet/rpcwallet.h index 8c149d455b..fd8a41ed14 100644 --- a/src/wallet/rpcwallet.h +++ b/src/wallet/rpcwallet.h @@ -5,11 +5,13 @@ #ifndef BITCOIN_WALLET_RPCWALLET_H #define BITCOIN_WALLET_RPCWALLET_H +#include <span.h> + #include <memory> #include <string> #include <vector> -class CRPCTable; +class CRPCCommand; class CWallet; class JSONRPCRequest; class LegacyScriptPubKeyMan; @@ -19,7 +21,6 @@ class CTransaction; namespace interfaces { class Chain; -class Handler; } //! Pointer to chain interface that needs to be declared as a global to be @@ -27,8 +28,7 @@ class Handler; //! RPC framework, there's currently no direct way to pass in state to RPC //! methods without globals. extern interfaces::Chain* g_rpc_chain; - -void RegisterWalletRPCCommands(interfaces::Chain& chain, std::vector<std::unique_ptr<interfaces::Handler>>& handlers); +Span<const CRPCCommand> GetWalletRPCCommands(); /** * Figures out what wallet, if any, to use for a JSONRPCRequest. |