Skip to content

Commit 2a7c3bc

Browse files
committed
Merge #16436: gui: Do not create payment server if -disablewallet option provided
4057b7a wallet: Recognize -disablewallet option early (Hennadii Stepanov) Pull request description: This PR makes early check for the `-disablewallet` option. If `-disablewallet=1`, objects `PaymentServer` and `WalletController` are nor created. ACKs for top commit: jonasschnelli: utACK 4057b7a laanwj: ACK 4057b7a Tree-SHA512: 74633cd1eacd0914c73712e6dff190255b5378595cfee7eaeb91e17671fc9120928034739f4ae1c53b86f46c4b400390877241384376b2fc534de326d3ab0944
2 parents b21acab + 4057b7a commit 2a7c3bc

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>
@@ -207,12 +208,6 @@ BitcoinApplication::~BitcoinApplication()
207208

208209
delete window;
209210
window = nullptr;
210-
#ifdef ENABLE_WALLET
211-
delete paymentServer;
212-
paymentServer = nullptr;
213-
delete m_wallet_controller;
214-
m_wallet_controller = nullptr;
215-
#endif
216211
delete optionsModel;
217212
optionsModel = nullptr;
218213
delete platformStyle;
@@ -328,24 +323,21 @@ void BitcoinApplication::initializeResult(bool success)
328323
{
329324
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
330325
qInfo() << "Platform customization:" << platformStyle->getName();
331-
#ifdef ENABLE_WALLET
332-
m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
333-
#ifdef ENABLE_BIP70
334-
PaymentServer::LoadRootCAs();
335-
#endif
336-
if (paymentServer) {
337-
paymentServer->setOptionsModel(optionsModel);
338-
#ifdef ENABLE_BIP70
339-
connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
340-
#endif
341-
}
342-
#endif
343-
344326
clientModel = new ClientModel(m_node, optionsModel);
345327
window->setClientModel(clientModel);
346328
#ifdef ENABLE_WALLET
347-
window->setWalletController(m_wallet_controller);
329+
if (WalletModel::isWalletEnabled()) {
330+
m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
331+
window->setWalletController(m_wallet_controller);
332+
if (paymentServer) {
333+
paymentServer->setOptionsModel(optionsModel);
334+
#ifdef ENABLE_BIP70
335+
PaymentServer::LoadRootCAs();
336+
connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
348337
#endif
338+
}
339+
}
340+
#endif // ENABLE_WALLET
349341

350342
// If -min option passed, start window minimized (iconified) or minimized to tray
351343
if (!gArgs.GetBoolArg("-min", false)) {
@@ -549,8 +541,10 @@ int GuiMain(int argc, char* argv[])
549541

550542
// Start up the payment server early, too, so impatient users that click on
551543
// bitcoin: links repeatedly have their payment requests routed to this process:
552-
app.createPaymentServer();
553-
#endif
544+
if (WalletModel::isWalletEnabled()) {
545+
app.createPaymentServer();
546+
}
547+
#endif // ENABLE_WALLET
554548

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

0 commit comments

Comments
 (0)