Skip to content

Commit 4057b7a

Browse files
committed
wallet: Recognize -disablewallet option early
1 parent 51a6e2c commit 4057b7a

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

src/qt/bitcoin.cpp

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
#ifdef ENABLE_WALLET
2626
#include <qt/paymentserver.h>
2727
#include <qt/walletcontroller.h>
28-
#endif
28+
#include <qt/walletmodel.h>
29+
#endif // ENABLE_WALLET
2930

3031
#include <interfaces/handler.h>
3132
#include <interfaces/node.h>
@@ -210,12 +211,6 @@ BitcoinApplication::~BitcoinApplication()
210211

211212
delete window;
212213
window = nullptr;
213-
#ifdef ENABLE_WALLET
214-
delete paymentServer;
215-
paymentServer = nullptr;
216-
delete m_wallet_controller;
217-
m_wallet_controller = nullptr;
218-
#endif
219214
delete optionsModel;
220215
optionsModel = nullptr;
221216
delete platformStyle;
@@ -331,24 +326,21 @@ void BitcoinApplication::initializeResult(bool success)
331326
{
332327
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
333328
qInfo() << "Platform customization:" << platformStyle->getName();
334-
#ifdef ENABLE_WALLET
335-
m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
336-
#ifdef ENABLE_BIP70
337-
PaymentServer::LoadRootCAs();
338-
#endif
339-
if (paymentServer) {
340-
paymentServer->setOptionsModel(optionsModel);
341-
#ifdef ENABLE_BIP70
342-
connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
343-
#endif
344-
}
345-
#endif
346-
347329
clientModel = new ClientModel(m_node, optionsModel);
348330
window->setClientModel(clientModel);
349331
#ifdef ENABLE_WALLET
350-
window->setWalletController(m_wallet_controller);
332+
if (WalletModel::isWalletEnabled()) {
333+
m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
334+
window->setWalletController(m_wallet_controller);
335+
if (paymentServer) {
336+
paymentServer->setOptionsModel(optionsModel);
337+
#ifdef ENABLE_BIP70
338+
PaymentServer::LoadRootCAs();
339+
connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
351340
#endif
341+
}
342+
}
343+
#endif // ENABLE_WALLET
352344

353345
// If -min option passed, start window minimized (iconified) or minimized to tray
354346
if (!gArgs.GetBoolArg("-min", false)) {
@@ -546,8 +538,10 @@ int GuiMain(int argc, char* argv[])
546538

547539
// Start up the payment server early, too, so impatient users that click on
548540
// bitcoin: links repeatedly have their payment requests routed to this process:
549-
app.createPaymentServer();
550-
#endif
541+
if (WalletModel::isWalletEnabled()) {
542+
app.createPaymentServer();
543+
}
544+
#endif // ENABLE_WALLET
551545

552546
/// 9. Main GUI initialization
553547
// Install global event filter that makes sure that long tooltips can be word-wrapped

0 commit comments

Comments
 (0)