aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-07-23 15:38:10 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-07-23 15:38:10 +0300
commit4057b7acb7125739537078d026ad96bb21708e3c (patch)
tree54ca2fb7523172a833720ee63af929a9b2a3ea77 /src/qt/bitcoin.cpp
parent51a6e2c4192913c9c18507d8dfb3302500b26cc3 (diff)
downloadbitcoin-4057b7acb7125739537078d026ad96bb21708e3c.tar.xz
wallet: Recognize -disablewallet option early
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 4a9742f7b7..6e2cbddb0a 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -25,7 +25,8 @@
#ifdef ENABLE_WALLET
#include <qt/paymentserver.h>
#include <qt/walletcontroller.h>
-#endif
+#include <qt/walletmodel.h>
+#endif // ENABLE_WALLET
#include <interfaces/handler.h>
#include <interfaces/node.h>
@@ -210,12 +211,6 @@ BitcoinApplication::~BitcoinApplication()
delete window;
window = nullptr;
-#ifdef ENABLE_WALLET
- delete paymentServer;
- paymentServer = nullptr;
- delete m_wallet_controller;
- m_wallet_controller = nullptr;
-#endif
delete optionsModel;
optionsModel = nullptr;
delete platformStyle;
@@ -331,24 +326,21 @@ void BitcoinApplication::initializeResult(bool success)
{
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
qInfo() << "Platform customization:" << platformStyle->getName();
-#ifdef ENABLE_WALLET
- m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
-#ifdef ENABLE_BIP70
- PaymentServer::LoadRootCAs();
-#endif
- if (paymentServer) {
- paymentServer->setOptionsModel(optionsModel);
-#ifdef ENABLE_BIP70
- connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
-#endif
- }
-#endif
-
clientModel = new ClientModel(m_node, optionsModel);
window->setClientModel(clientModel);
#ifdef ENABLE_WALLET
- window->setWalletController(m_wallet_controller);
+ if (WalletModel::isWalletEnabled()) {
+ m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this);
+ window->setWalletController(m_wallet_controller);
+ if (paymentServer) {
+ paymentServer->setOptionsModel(optionsModel);
+#ifdef ENABLE_BIP70
+ PaymentServer::LoadRootCAs();
+ connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK);
#endif
+ }
+ }
+#endif // ENABLE_WALLET
// If -min option passed, start window minimized (iconified) or minimized to tray
if (!gArgs.GetBoolArg("-min", false)) {
@@ -546,8 +538,10 @@ int GuiMain(int argc, char* argv[])
// Start up the payment server early, too, so impatient users that click on
// bitcoin: links repeatedly have their payment requests routed to this process:
- app.createPaymentServer();
-#endif
+ if (WalletModel::isWalletEnabled()) {
+ app.createPaymentServer();
+ }
+#endif // ENABLE_WALLET
/// 9. Main GUI initialization
// Install global event filter that makes sure that long tooltips can be word-wrapped