Skip to content

Commit 3076556

Browse files
committed
[build] Move dummy wallet into its own .cpp file.
Removes the ifdef ENABLE_WALLET from init.cpp.
1 parent b8cf492 commit 3076556

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ libbitcoin_server_a_SOURCES = \
260260
versionbits.cpp \
261261
$(BITCOIN_CORE_H)
262262

263+
if !ENABLE_WALLET
264+
libbitcoin_server_a_SOURCES += dummywallet.cpp
265+
endif
266+
263267
if ENABLE_ZMQ
264268
libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
265269
libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

src/dummywallet.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) 2018 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <stdio.h>
6+
#include <util.h>
7+
#include <walletinitinterface.h>
8+
9+
class DummyWalletInit : public WalletInitInterface {
10+
public:
11+
12+
void AddWalletOptions() const override;
13+
bool ParameterInteraction() const override {return true;}
14+
void RegisterRPC(CRPCTable &) const override {}
15+
bool Verify() const override {return true;}
16+
bool Open() const override {LogPrintf("No wallet support compiled in!\n"); return true;}
17+
void Start(CScheduler& scheduler) const override {}
18+
void Flush() const override {}
19+
void Stop() const override {}
20+
void Close() const override {}
21+
};
22+
23+
void DummyWalletInit::AddWalletOptions() const
24+
{
25+
std::vector<std::string> opts = {"-addresstype", "-changetype", "-disablewallet", "-discardfee=<amt>", "-fallbackfee=<amt>",
26+
"-keypool=<n>", "-mintxfee=<amt>", "-paytxfee=<amt>", "-rescan", "-salvagewallet", "-spendzeroconfchange", "-txconfirmtarget=<n>",
27+
"-upgradewallet", "-wallet=<path>", "-walletbroadcast", "-walletdir=<dir>", "-walletnotify=<cmd>", "-walletrbf", "-zapwallettxes=<mode>",
28+
"-dblogsize=<n>", "-flushwallet", "-privdb", "-walletrejectlongchains"};
29+
gArgs.AddHiddenArgs(opts);
30+
}
31+
32+
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();

src/init.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,6 @@ static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
7474
std::unique_ptr<CConnman> g_connman;
7575
std::unique_ptr<PeerLogicValidation> peerLogic;
7676

77-
#if !(ENABLE_WALLET)
78-
class DummyWalletInit : public WalletInitInterface {
79-
public:
80-
81-
void AddWalletOptions() const override;
82-
bool ParameterInteraction() const override {return true;}
83-
void RegisterRPC(CRPCTable &) const override {}
84-
bool Verify() const override {return true;}
85-
bool Open() const override {LogPrintf("No wallet support compiled in!\n"); return true;}
86-
void Start(CScheduler& scheduler) const override {}
87-
void Flush() const override {}
88-
void Stop() const override {}
89-
void Close() const override {}
90-
};
91-
92-
void DummyWalletInit::AddWalletOptions() const
93-
{
94-
std::vector<std::string> opts = {"-addresstype", "-changetype", "-disablewallet", "-discardfee=<amt>", "-fallbackfee=<amt>",
95-
"-keypool=<n>", "-mintxfee=<amt>", "-paytxfee=<amt>", "-rescan", "-salvagewallet", "-spendzeroconfchange", "-txconfirmtarget=<n>",
96-
"-upgradewallet", "-wallet=<path>", "-walletbroadcast", "-walletdir=<dir>", "-walletnotify=<cmd>", "-walletrbf", "-zapwallettxes=<mode>",
97-
"-dblogsize=<n>", "-flushwallet", "-privdb", "-walletrejectlongchains"};
98-
gArgs.AddHiddenArgs(opts);
99-
}
100-
101-
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
102-
#endif
103-
10477
#ifdef WIN32
10578
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
10679
// accessing block files don't count towards the fd_set size limit

0 commit comments

Comments
 (0)