aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-09-13 15:46:21 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-09-13 15:50:16 +0200
commit49fd485bbf5b140e23b538c7c9355e33d7193b48 (patch)
tree65f490cdeea2508c51f0c6c3200a01b4508c7e2c /src
parent962c302710cd6556a85ba953bac236f33b8e1a09 (diff)
parente4ef4b459548b4032b9da03b3103525f935acb82 (diff)
downloadbitcoin-49fd485bbf5b140e23b538c7c9355e33d7193b48.tar.xz
Merge #14208: [build] Actually remove ENABLE_WALLET
e4ef4b459548b4032b9da03b3103525f935acb82 [build] remove #ifdef ENABLE_WALLET from interfaces/node (John Newbery) Pull request description: Adds a couple of redefinitions to dummywallet.cpp. Tree-SHA512: d226bcccc46d089eac88beb54c31f6f18817682994b371f9793a5d28bec5d60dbdffacc8fc281807e25cc7f89da23e1f8f36fd99d12f8a40f77a972840e8c1b4
Diffstat (limited to 'src')
-rw-r--r--src/dummywallet.cpp18
-rw-r--r--src/interfaces/node.cpp20
-rw-r--r--src/interfaces/wallet.h4
3 files changed, 27 insertions, 15 deletions
diff --git a/src/dummywallet.cpp b/src/dummywallet.cpp
index 5b33daf85d..3714187a96 100644
--- a/src/dummywallet.cpp
+++ b/src/dummywallet.cpp
@@ -6,6 +6,8 @@
#include <util.h>
#include <walletinitinterface.h>
+class CWallet;
+
class DummyWalletInit : public WalletInitInterface {
public:
@@ -31,3 +33,19 @@ void DummyWalletInit::AddWalletOptions() const
}
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
+
+std::vector<std::shared_ptr<CWallet>> GetWallets()
+{
+ throw std::logic_error("Wallet function called in non-wallet build.");
+}
+
+namespace interfaces {
+
+class Wallet;
+
+std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet)
+{
+ throw std::logic_error("Wallet function called in non-wallet build.");
+}
+
+} // namespace interfaces
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp
index 1da58fe487..d95b41657c 100644
--- a/src/interfaces/node.cpp
+++ b/src/interfaces/node.cpp
@@ -32,19 +32,18 @@
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
-#ifdef ENABLE_WALLET
-#include <wallet/fees.h>
-#include <wallet/wallet.h>
-#define CHECK_WALLET(x) x
-#else
-#define CHECK_WALLET(x) throw std::logic_error("Wallet function called in non-wallet build.")
-#endif
#include <atomic>
#include <boost/thread/thread.hpp>
#include <univalue.h>
+class CWallet;
+std::vector<std::shared_ptr<CWallet>> GetWallets();
+
namespace interfaces {
+
+class Wallet;
+
namespace {
class NodeImpl : public Node
@@ -221,15 +220,11 @@ class NodeImpl : public Node
}
std::vector<std::unique_ptr<Wallet>> getWallets() override
{
-#ifdef ENABLE_WALLET
std::vector<std::unique_ptr<Wallet>> wallets;
for (const std::shared_ptr<CWallet>& wallet : GetWallets()) {
wallets.emplace_back(MakeWallet(wallet));
}
return wallets;
-#else
- throw std::logic_error("Node::getWallets() called in non-wallet build.");
-#endif
}
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
{
@@ -249,8 +244,7 @@ class NodeImpl : public Node
}
std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override
{
- CHECK_WALLET(
- return MakeHandler(::uiInterface.LoadWallet_connect([fn](std::shared_ptr<CWallet> wallet) { fn(MakeWallet(wallet)); })));
+ return MakeHandler(::uiInterface.LoadWallet_connect([fn](std::shared_ptr<CWallet> wallet) { fn(MakeWallet(wallet)); }));
}
std::unique_ptr<Handler> handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) override
{
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index 44240a5726..7aa91f37e1 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -366,8 +366,8 @@ struct WalletTxOut
bool is_spent = false;
};
-//! Return implementation of Wallet interface. This function will be undefined
-//! in builds where ENABLE_WALLET is false.
+//! Return implementation of Wallet interface. This function is defined in
+//! dummywallet.cpp and throws if the wallet component is not compiled.
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet);
} // namespace interfaces