File tree Expand file tree Collapse file tree 3 files changed +27
-15
lines changed Expand file tree Collapse file tree 3 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 6
6
#include < util.h>
7
7
#include < walletinitinterface.h>
8
8
9
+ class CWallet ;
10
+
9
11
class DummyWalletInit : public WalletInitInterface {
10
12
public:
11
13
@@ -31,3 +33,19 @@ void DummyWalletInit::AddWalletOptions() const
31
33
}
32
34
33
35
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
36
+
37
+ std::vector<std::shared_ptr<CWallet>> GetWallets ()
38
+ {
39
+ throw std::logic_error (" Wallet function called in non-wallet build." );
40
+ }
41
+
42
+ namespace interfaces {
43
+
44
+ class Wallet ;
45
+
46
+ std::unique_ptr<Wallet> MakeWallet (const std::shared_ptr<CWallet>& wallet)
47
+ {
48
+ throw std::logic_error (" Wallet function called in non-wallet build." );
49
+ }
50
+
51
+ } // namespace interfaces
Original file line number Diff line number Diff line change 32
32
#if defined(HAVE_CONFIG_H)
33
33
#include < config/bitcoin-config.h>
34
34
#endif
35
- #ifdef ENABLE_WALLET
36
- #include < wallet/fees.h>
37
- #include < wallet/wallet.h>
38
- #define CHECK_WALLET (x ) x
39
- #else
40
- #define CHECK_WALLET (x ) throw std::logic_error (" Wallet function called in non-wallet build." )
41
- #endif
42
35
43
36
#include < atomic>
44
37
#include < boost/thread/thread.hpp>
45
38
#include < univalue.h>
46
39
40
+ class CWallet ;
41
+ std::vector<std::shared_ptr<CWallet>> GetWallets ();
42
+
47
43
namespace interfaces {
44
+
45
+ class Wallet ;
46
+
48
47
namespace {
49
48
50
49
class NodeImpl : public Node
@@ -221,15 +220,11 @@ class NodeImpl : public Node
221
220
}
222
221
std::vector<std::unique_ptr<Wallet>> getWallets () override
223
222
{
224
- #ifdef ENABLE_WALLET
225
223
std::vector<std::unique_ptr<Wallet>> wallets;
226
224
for (const std::shared_ptr<CWallet>& wallet : GetWallets ()) {
227
225
wallets.emplace_back (MakeWallet (wallet));
228
226
}
229
227
return wallets;
230
- #else
231
- throw std::logic_error (" Node::getWallets() called in non-wallet build." );
232
- #endif
233
228
}
234
229
std::unique_ptr<Handler> handleInitMessage (InitMessageFn fn) override
235
230
{
@@ -249,8 +244,7 @@ class NodeImpl : public Node
249
244
}
250
245
std::unique_ptr<Handler> handleLoadWallet (LoadWalletFn fn) override
251
246
{
252
- CHECK_WALLET (
253
- return MakeHandler (::uiInterface.LoadWallet_connect ([fn](std::shared_ptr<CWallet> wallet) { fn (MakeWallet (wallet)); })));
247
+ return MakeHandler (::uiInterface.LoadWallet_connect ([fn](std::shared_ptr<CWallet> wallet) { fn (MakeWallet (wallet)); }));
254
248
}
255
249
std::unique_ptr<Handler> handleNotifyNumConnectionsChanged (NotifyNumConnectionsChangedFn fn) override
256
250
{
Original file line number Diff line number Diff line change @@ -366,8 +366,8 @@ struct WalletTxOut
366
366
bool is_spent = false ;
367
367
};
368
368
369
- // ! Return implementation of Wallet interface. This function will be undefined
370
- // ! in builds where ENABLE_WALLET is false .
369
+ // ! Return implementation of Wallet interface. This function is defined in
370
+ // ! dummywallet.cpp and throws if the wallet component is not compiled .
371
371
std::unique_ptr<Wallet> MakeWallet (const std::shared_ptr<CWallet>& wallet);
372
372
373
373
} // namespace interfaces
You can’t perform that action at this time.
0 commit comments