diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-12-23 15:16:24 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-23 15:16:31 +0100 |
commit | f7367b88e1c2cf1feca4d49f49b9616a5ad85a44 (patch) | |
tree | 7309d86ed2cd0793e7f8b7912bcf6c1ba30888b1 | |
parent | f5c678e5c3f013520078768027cc8ff860a15279 (diff) | |
parent | ff5f6dea5336075d1a6cace1112be3252d97540b (diff) | |
download | bitcoin-f7367b88e1c2cf1feca4d49f49b9616a5ad85a44.tar.xz |
Merge bitcoin/bitcoin#23842: scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader
ff5f6dea5336075d1a6cace1112be3252d97540b scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader (Russell Yanofsky)
Pull request description:
Name has been confusing since it was introduced, and it was pointed in recent review club https://bitcoincore.reviews/10102 that it was particularly unclear how `interfaces::WalletClient` was different from `interfaces::Wallet`.
ACKs for top commit:
w0xlt:
ACK ff5f6de
Tree-SHA512: 26fa10baa457e76da1933adab187e9be61b8d76cff1cf2c73ad4320461c7e31fb9db07b7c2486998294826beb4a1aca255c14903920b443db6213e653c5f7e0a
-rw-r--r-- | src/dummywallet.cpp | 4 | ||||
-rw-r--r-- | src/init/bitcoin-gui.cpp | 4 | ||||
-rw-r--r-- | src/init/bitcoin-node.cpp | 4 | ||||
-rw-r--r-- | src/init/bitcoin-qt.cpp | 4 | ||||
-rw-r--r-- | src/init/bitcoind.cpp | 4 | ||||
-rw-r--r-- | src/interfaces/init.cpp | 2 | ||||
-rw-r--r-- | src/interfaces/init.h | 4 | ||||
-rw-r--r-- | src/interfaces/node.h | 8 | ||||
-rw-r--r-- | src/interfaces/wallet.h | 6 | ||||
-rw-r--r-- | src/node/context.h | 4 | ||||
-rw-r--r-- | src/node/interfaces.cpp | 6 | ||||
-rw-r--r-- | src/node/ui_interface.h | 2 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 2 | ||||
-rw-r--r-- | src/qt/splashscreen.cpp | 2 | ||||
-rw-r--r-- | src/qt/test/addressbooktests.cpp | 6 | ||||
-rw-r--r-- | src/qt/test/wallettests.cpp | 6 | ||||
-rw-r--r-- | src/qt/walletcontroller.cpp | 10 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 2 | ||||
-rw-r--r-- | src/wallet/init.cpp | 6 | ||||
-rw-r--r-- | src/wallet/interfaces.cpp | 14 | ||||
-rw-r--r-- | src/wallet/test/init_test_fixture.cpp | 2 | ||||
-rw-r--r-- | src/wallet/test/init_test_fixture.h | 2 | ||||
-rw-r--r-- | src/wallet/test/init_tests.cpp | 14 | ||||
-rw-r--r-- | src/wallet/test/wallet_test_fixture.cpp | 2 | ||||
-rw-r--r-- | src/wallet/test/wallet_test_fixture.h | 2 | ||||
-rw-r--r-- | src/wallet/wallet.h | 2 |
26 files changed, 62 insertions, 62 deletions
diff --git a/src/dummywallet.cpp b/src/dummywallet.cpp index 7f6471740f..6aa89a2402 100644 --- a/src/dummywallet.cpp +++ b/src/dummywallet.cpp @@ -12,7 +12,7 @@ namespace interfaces { class Chain; class Handler; class Wallet; -class WalletClient; +class WalletLoader; } class DummyWalletInit : public WalletInitInterface { @@ -64,7 +64,7 @@ std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet) throw std::logic_error("Wallet function called in non-wallet build."); } -std::unique_ptr<WalletClient> MakeWalletClient(Chain& chain, ArgsManager& args) +std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args) { throw std::logic_error("Wallet function called in non-wallet build."); } diff --git a/src/init/bitcoin-gui.cpp b/src/init/bitcoin-gui.cpp index c549ed3cc0..f13bd4a05d 100644 --- a/src/init/bitcoin-gui.cpp +++ b/src/init/bitcoin-gui.cpp @@ -27,9 +27,9 @@ public: } std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); } std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); } - std::unique_ptr<interfaces::WalletClient> makeWalletClient(interfaces::Chain& chain) override + std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain) override { - return MakeWalletClient(chain, *Assert(m_node.args)); + return MakeWalletLoader(chain, *Assert(m_node.args)); } std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); } interfaces::Ipc* ipc() override { return m_ipc.get(); } diff --git a/src/init/bitcoin-node.cpp b/src/init/bitcoin-node.cpp index fa56153745..be6dfefe7d 100644 --- a/src/init/bitcoin-node.cpp +++ b/src/init/bitcoin-node.cpp @@ -29,9 +29,9 @@ public: } std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); } std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); } - std::unique_ptr<interfaces::WalletClient> makeWalletClient(interfaces::Chain& chain) override + std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain) override { - return MakeWalletClient(chain, *Assert(m_node.args)); + return MakeWalletLoader(chain, *Assert(m_node.args)); } std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); } interfaces::Ipc* ipc() override { return m_ipc.get(); } diff --git a/src/init/bitcoin-qt.cpp b/src/init/bitcoin-qt.cpp index d71177e885..17a074cb8d 100644 --- a/src/init/bitcoin-qt.cpp +++ b/src/init/bitcoin-qt.cpp @@ -24,9 +24,9 @@ public: } std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); } std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); } - std::unique_ptr<interfaces::WalletClient> makeWalletClient(interfaces::Chain& chain) override + std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain) override { - return MakeWalletClient(chain, *Assert(m_node.args)); + return MakeWalletLoader(chain, *Assert(m_node.args)); } std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); } NodeContext m_node; diff --git a/src/init/bitcoind.cpp b/src/init/bitcoind.cpp index 9c8d5bd9bb..9c2e44569a 100644 --- a/src/init/bitcoind.cpp +++ b/src/init/bitcoind.cpp @@ -24,9 +24,9 @@ public: } std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); } std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); } - std::unique_ptr<interfaces::WalletClient> makeWalletClient(interfaces::Chain& chain) override + std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain) override { - return MakeWalletClient(chain, *Assert(m_node.args)); + return MakeWalletLoader(chain, *Assert(m_node.args)); } std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); } NodeContext& m_node; diff --git a/src/interfaces/init.cpp b/src/interfaces/init.cpp index a3c949e616..f0f8aa5fed 100644 --- a/src/interfaces/init.cpp +++ b/src/interfaces/init.cpp @@ -11,7 +11,7 @@ namespace interfaces { std::unique_ptr<Node> Init::makeNode() { return {}; } std::unique_ptr<Chain> Init::makeChain() { return {}; } -std::unique_ptr<WalletClient> Init::makeWalletClient(Chain& chain) { return {}; } +std::unique_ptr<WalletLoader> Init::makeWalletLoader(Chain& chain) { return {}; } std::unique_ptr<Echo> Init::makeEcho() { return {}; } Ipc* Init::ipc() { return nullptr; } } // namespace interfaces diff --git a/src/interfaces/init.h b/src/interfaces/init.h index 2a38054a17..a4ecf4b5d1 100644 --- a/src/interfaces/init.h +++ b/src/interfaces/init.h @@ -14,7 +14,7 @@ class Chain; class Echo; class Ipc; class Node; -class WalletClient; +class WalletLoader; //! Initial interface created when a process is first started, and used to give //! and get access to other interfaces (Node, Chain, Wallet, etc). @@ -29,7 +29,7 @@ public: virtual ~Init() = default; virtual std::unique_ptr<Node> makeNode(); virtual std::unique_ptr<Chain> makeChain(); - virtual std::unique_ptr<WalletClient> makeWalletClient(Chain& chain); + virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain); virtual std::unique_ptr<Echo> makeEcho(); virtual Ipc* ipc(); }; diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 974156e6e1..cf45b0b392 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -37,7 +37,7 @@ struct bilingual_str; namespace interfaces { class Handler; -class WalletClient; +class WalletLoader; struct BlockTip; //! Block and header tip information @@ -187,8 +187,8 @@ public: //! Broadcast transaction. virtual TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, std::string& err_string) = 0; - //! Get wallet client. - virtual WalletClient& walletClient() = 0; + //! Get wallet loader. + virtual WalletLoader& walletLoader() = 0; //! Register handler for init messages. using InitMessageFn = std::function<void(const std::string& message)>; @@ -210,7 +210,7 @@ public: using ShowProgressFn = std::function<void(const std::string& title, int progress, bool resume_possible)>; virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0; - //! Register handler for wallet client constructed messages. + //! Register handler for wallet loader constructed messages. using InitWalletFn = std::function<void()>; virtual std::unique_ptr<Handler> handleInitWallet(InitWalletFn fn) = 0; diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 77e15fc097..a02134f2b2 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -313,7 +313,7 @@ public: //! Wallet chain client that in addition to having chain client methods for //! starting up, shutting down, and registering RPCs, also has additional //! methods (called by the GUI) to load and create wallets. -class WalletClient : public ChainClient +class WalletLoader : public ChainClient { public: //! Create new wallet. @@ -422,9 +422,9 @@ struct WalletTxOut //! dummywallet.cpp and throws if the wallet component is not compiled. std::unique_ptr<Wallet> MakeWallet(WalletContext& context, const std::shared_ptr<CWallet>& wallet); -//! Return implementation of ChainClient interface for a wallet client. This +//! Return implementation of ChainClient interface for a wallet loader. This //! function will be undefined in builds where ENABLE_WALLET is false. -std::unique_ptr<WalletClient> MakeWalletClient(Chain& chain, ArgsManager& args); +std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args); } // namespace interfaces diff --git a/src/node/context.h b/src/node/context.h index 26873345b4..e0f85ec6fc 100644 --- a/src/node/context.h +++ b/src/node/context.h @@ -23,7 +23,7 @@ namespace interfaces { class Chain; class ChainClient; class Init; -class WalletClient; +class WalletLoader; } // namespace interfaces //! NodeContext struct containing references to chain state and connection @@ -52,7 +52,7 @@ struct NodeContext { std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients; //! Reference to chain client that should used to load or create wallets //! opened by the gui. - interfaces::WalletClient* wallet_client{nullptr}; + interfaces::WalletLoader* wallet_loader{nullptr}; std::unique_ptr<CScheduler> scheduler; std::function<void()> rpc_interruption_point = [] {}; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 8109dce2c0..21bfdff5da 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -63,7 +63,7 @@ using interfaces::FoundBlock; using interfaces::Handler; using interfaces::MakeHandler; using interfaces::Node; -using interfaces::WalletClient; +using interfaces::WalletLoader; namespace node { namespace { @@ -280,9 +280,9 @@ public: { return BroadcastTransaction(*m_context, std::move(tx), err_string, max_tx_fee, /*relay=*/ true, /*wait_callback=*/ false); } - WalletClient& walletClient() override + WalletLoader& walletLoader() override { - return *Assert(m_context->wallet_client); + return *Assert(m_context->wallet_loader); } std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { diff --git a/src/node/ui_interface.h b/src/node/ui_interface.h index f969bcde21..5e11b08976 100644 --- a/src/node/ui_interface.h +++ b/src/node/ui_interface.h @@ -82,7 +82,7 @@ public: /** Progress message during initialization. */ ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message); - /** Wallet client created. */ + /** Wallet loader created. */ ADD_SIGNALS_DECL_WRAPPER(InitWallet, void, ); /** Number of network connections changed. */ diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 81a1d88d20..e7d4006a70 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1242,7 +1242,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmoun // On new transaction, make an info balloon QString msg = tr("Date: %1\n").arg(date) + tr("Amount: %1\n").arg(BitcoinUnits::formatWithUnit(unit, amount, true)); - if (m_node.walletClient().getWallets().size() > 1 && !walletName.isEmpty()) { + if (m_node.walletLoader().getWallets().size() > 1 && !walletName.isEmpty()) { msg += tr("Wallet: %1\n").arg(walletName); } msg += tr("Type: %1\n").arg(type); diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 85703b3350..558ec41bd8 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -201,7 +201,7 @@ void SplashScreen::handleLoadWallet() { #ifdef ENABLE_WALLET if (!WalletModel::isWalletEnabled()) return; - m_handler_load_wallet = m_node->walletClient().handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { + m_handler_load_wallet = m_node->walletLoader().handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, false))); m_connected_wallets.emplace_back(std::move(wallet)); }); diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp index 39cc1c1e1d..e814452907 100644 --- a/src/qt/test/addressbooktests.cpp +++ b/src/qt/test/addressbooktests.cpp @@ -60,8 +60,8 @@ void EditAddressAndSubmit( void TestAddAddressesToSendBook(interfaces::Node& node) { TestChain100Setup test; - auto wallet_client = interfaces::MakeWalletClient(*test.m_node.chain, *Assert(test.m_node.args)); - test.m_node.wallet_client = wallet_client.get(); + auto wallet_loader = interfaces::MakeWalletLoader(*test.m_node.chain, *Assert(test.m_node.args)); + test.m_node.wallet_loader = wallet_loader.get(); node.setContext(&test.m_node); const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase()); wallet->LoadWallet(); @@ -115,7 +115,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node) std::unique_ptr<const PlatformStyle> platformStyle(PlatformStyle::instantiate("other")); OptionsModel optionsModel; ClientModel clientModel(node, &optionsModel); - WalletContext& context = *node.walletClient().context(); + WalletContext& context = *node.walletLoader().context(); AddWallet(context, wallet); WalletModel walletModel(interfaces::MakeWallet(context, wallet), clientModel, platformStyle.get()); RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt); diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 93d6aa805f..dff69058e5 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -138,8 +138,8 @@ void TestGUI(interfaces::Node& node) for (int i = 0; i < 5; ++i) { test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); } - auto wallet_client = interfaces::MakeWalletClient(*test.m_node.chain, *Assert(test.m_node.args)); - test.m_node.wallet_client = wallet_client.get(); + auto wallet_loader = interfaces::MakeWalletLoader(*test.m_node.chain, *Assert(test.m_node.args)); + test.m_node.wallet_loader = wallet_loader.get(); node.setContext(&test.m_node); const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", gArgs, CreateMockWalletDatabase()); wallet->LoadWallet(); @@ -175,7 +175,7 @@ void TestGUI(interfaces::Node& node) TransactionView transactionView(platformStyle.get()); OptionsModel optionsModel; ClientModel clientModel(node, &optionsModel); - WalletContext& context = *node.walletClient().context(); + WalletContext& context = *node.walletLoader().context(); AddWallet(context, wallet); WalletModel walletModel(interfaces::MakeWallet(context, wallet), clientModel, platformStyle.get()); RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt); diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index b9a9fcf3d1..6cf7ec36c2 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -37,7 +37,7 @@ WalletController::WalletController(ClientModel& client_model, const PlatformStyl , m_platform_style(platform_style) , m_options_model(client_model.getOptionsModel()) { - m_handler_load_wallet = m_node.walletClient().handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { + m_handler_load_wallet = m_node.walletLoader().handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { getOrCreateWallet(std::move(wallet)); }); @@ -61,7 +61,7 @@ std::map<std::string, bool> WalletController::listWalletDir() const { QMutexLocker locker(&m_mutex); std::map<std::string, bool> wallets; - for (const std::string& name : m_node.walletClient().listWalletDir()) { + for (const std::string& name : m_node.walletLoader().listWalletDir()) { wallets[name] = false; } for (WalletModel* wallet_model : m_wallets) { @@ -255,7 +255,7 @@ void CreateWalletActivity::createWallet() } QTimer::singleShot(500, worker(), [this, name, flags] { - std::unique_ptr<interfaces::Wallet> wallet = node().walletClient().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message); + std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message); if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet)); @@ -336,7 +336,7 @@ void OpenWalletActivity::open(const std::string& path) tr("Opening Wallet <b>%1</b>…").arg(name.toHtmlEscaped())); QTimer::singleShot(0, worker(), [this, path] { - std::unique_ptr<interfaces::Wallet> wallet = node().walletClient().loadWallet(path, m_error_message, m_warning_message); + std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().loadWallet(path, m_error_message, m_warning_message); if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet)); @@ -359,7 +359,7 @@ void LoadWalletsActivity::load() tr("Loading wallets…")); QTimer::singleShot(0, worker(), [this] { - for (auto& wallet : node().walletClient().getWallets()) { + for (auto& wallet : node().walletLoader().getWallets()) { m_wallet_controller->getOrCreateWallet(std::move(wallet)); } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 052453cf65..5f9c0d6a12 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -583,7 +583,7 @@ QString WalletModel::getDisplayName() const bool WalletModel::isMultiwallet() { - return m_node.walletClient().getWallets().size() > 1; + return m_node.walletLoader().getWallets().size() > 1; } void WalletModel::refresh(bool pk_hash_only) diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 4ff049170e..5def02d96a 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -130,7 +130,7 @@ void WalletInit::Construct(NodeContext& node) const LogPrintf("Wallet disabled!\n"); return; } - auto wallet_client = node.init->makeWalletClient(*node.chain); - node.wallet_client = wallet_client.get(); - node.chain_clients.emplace_back(std::move(wallet_client)); + auto wallet_loader = node.init->makeWalletLoader(*node.chain); + node.wallet_loader = wallet_loader.get(); + node.chain_clients.emplace_back(std::move(wallet_loader)); } diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 04501ea5a2..54986413d6 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -40,7 +40,7 @@ using interfaces::MakeHandler; using interfaces::Wallet; using interfaces::WalletAddress; using interfaces::WalletBalances; -using interfaces::WalletClient; +using interfaces::WalletLoader; using interfaces::WalletOrderForm; using interfaces::WalletTx; using interfaces::WalletTxOut; @@ -510,15 +510,15 @@ public: std::shared_ptr<CWallet> m_wallet; }; -class WalletClientImpl : public WalletClient +class WalletLoaderImpl : public WalletLoader { public: - WalletClientImpl(Chain& chain, ArgsManager& args) + WalletLoaderImpl(Chain& chain, ArgsManager& args) { m_context.chain = &chain; m_context.args = &args; } - ~WalletClientImpl() override { UnloadWallets(m_context); } + ~WalletLoaderImpl() override { UnloadWallets(m_context); } //! ChainClient methods void registerRpcs() override @@ -539,7 +539,7 @@ public: void stop() override { return StopWallets(m_context); } void setMockTime(int64_t time) override { return SetMockTime(time); } - //! WalletClient methods + //! WalletLoader methods std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector<bilingual_str>& warnings) override { std::shared_ptr<CWallet> wallet; @@ -600,8 +600,8 @@ public: namespace interfaces { std::unique_ptr<Wallet> MakeWallet(WalletContext& context, const std::shared_ptr<CWallet>& wallet) { return wallet ? std::make_unique<wallet::WalletImpl>(context, wallet) : nullptr; } -std::unique_ptr<WalletClient> MakeWalletClient(Chain& chain, ArgsManager& args) +std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args) { - return std::make_unique<wallet::WalletClientImpl>(chain, args); + return std::make_unique<wallet::WalletLoaderImpl>(chain, args); } } // namespace interfaces diff --git a/src/wallet/test/init_test_fixture.cpp b/src/wallet/test/init_test_fixture.cpp index 170675c035..ade2813e0a 100644 --- a/src/wallet/test/init_test_fixture.cpp +++ b/src/wallet/test/init_test_fixture.cpp @@ -11,7 +11,7 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName) { - m_wallet_client = MakeWalletClient(*m_node.chain, *Assert(m_node.args)); + m_wallet_loader = MakeWalletLoader(*m_node.chain, *Assert(m_node.args)); std::string sep; sep += fs::path::preferred_separator; diff --git a/src/wallet/test/init_test_fixture.h b/src/wallet/test/init_test_fixture.h index 37ae907de5..485aa50658 100644 --- a/src/wallet/test/init_test_fixture.h +++ b/src/wallet/test/init_test_fixture.h @@ -19,7 +19,7 @@ struct InitWalletDirTestingSetup: public BasicTestingSetup { fs::path m_datadir; fs::path m_cwd; std::map<std::string, fs::path> m_walletdir_path_cases; - std::unique_ptr<interfaces::WalletClient> m_wallet_client; + std::unique_ptr<interfaces::WalletLoader> m_wallet_loader; }; #endif // BITCOIN_WALLET_TEST_INIT_TEST_FIXTURE_H diff --git a/src/wallet/test/init_tests.cpp b/src/wallet/test/init_tests.cpp index 222c2bf4b7..3bbf18043d 100644 --- a/src/wallet/test/init_tests.cpp +++ b/src/wallet/test/init_tests.cpp @@ -15,7 +15,7 @@ BOOST_FIXTURE_TEST_SUITE(init_tests, InitWalletDirTestingSetup) BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default) { SetWalletDir(m_walletdir_path_cases["default"]); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == true); fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", "")); fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]); @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default) BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom) { SetWalletDir(m_walletdir_path_cases["custom"]); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == true); fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", "")); fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]); @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_does_not_exist) SetWalletDir(m_walletdir_path_cases["nonexistent"]); { ASSERT_DEBUG_LOG("does not exist"); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == false); } } @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_directory) SetWalletDir(m_walletdir_path_cases["file"]); { ASSERT_DEBUG_LOG("is not a directory"); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == false); } } @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_relative) SetWalletDir(m_walletdir_path_cases["relative"]); { ASSERT_DEBUG_LOG("is a relative path"); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == false); } } @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_is_not_relative) BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing) { SetWalletDir(m_walletdir_path_cases["trailing"]); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == true); fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", "")); fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing) BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2) { SetWalletDir(m_walletdir_path_cases["trailing2"]); - bool result = m_wallet_client->verify(); + bool result = m_wallet_loader->verify(); BOOST_CHECK(result == true); fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", "")); fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]); diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp index 762702522e..83bc75528d 100644 --- a/src/wallet/test/wallet_test_fixture.cpp +++ b/src/wallet/test/wallet_test_fixture.cpp @@ -12,7 +12,7 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName) { m_wallet.LoadWallet(); m_chain_notifications_handler = m_node.chain->handleNotifications({ &m_wallet, [](CWallet*) {} }); - m_wallet_client->registerRpcs(); + m_wallet_loader->registerRpcs(); } WalletTestingSetup::~WalletTestingSetup() diff --git a/src/wallet/test/wallet_test_fixture.h b/src/wallet/test/wallet_test_fixture.h index 8bf2d36227..02d5707e36 100644 --- a/src/wallet/test/wallet_test_fixture.h +++ b/src/wallet/test/wallet_test_fixture.h @@ -21,7 +21,7 @@ struct WalletTestingSetup : public TestingSetup { explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN); ~WalletTestingSetup(); - std::unique_ptr<interfaces::WalletClient> m_wallet_client = interfaces::MakeWalletClient(*m_node.chain, *Assert(m_node.args)); + std::unique_ptr<interfaces::WalletLoader> m_wallet_loader = interfaces::MakeWalletLoader(*m_node.chain, *Assert(m_node.args)); CWallet m_wallet; std::unique_ptr<interfaces::Handler> m_chain_notifications_handler; }; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index e2a2aebeb5..30777dbe2c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -48,7 +48,7 @@ struct bilingual_str; //! Explicitly unload and delete the wallet. //! Blocks the current thread after signaling the unload intent so that all -//! wallet clients release the wallet. +//! wallet pointer owners release the wallet. //! Note that, when blocking is not required, the wallet is implicitly unloaded //! by the shared pointer deleter. void UnloadWallet(std::shared_ptr<CWallet>&& wallet); |