Merge #16436: gui: Do not create payment server if -disablewallet option provided

4057b7acb7125739537078d026ad96bb21708e3c 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 4057b7acb7125739537078d026ad96bb21708e3c
  laanwj:
    ACK 4057b7acb7125739537078d026ad96bb21708e3c

Tree-SHA512: 74633cd1eacd0914c73712e6dff190255b5378595cfee7eaeb91e17671fc9120928034739f4ae1c53b86f46c4b400390877241384376b2fc534de326d3ab0944
This commit is contained in:
Wladimir J. van der Laan 2019-07-29 17:18:38 +02:00 committed by munkybooty
parent 12e2ad89ce
commit 3f17cc9dd3

View File

@ -26,7 +26,8 @@
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
#include <qt/paymentserver.h> #include <qt/paymentserver.h>
#include <qt/walletcontroller.h> #include <qt/walletcontroller.h>
#endif #include <qt/walletmodel.h>
#endif // ENABLE_WALLET
#include <interfaces/handler.h> #include <interfaces/handler.h>
#include <interfaces/node.h> #include <interfaces/node.h>
@ -219,12 +220,6 @@ BitcoinApplication::~BitcoinApplication()
delete window; delete window;
window = nullptr; window = nullptr;
#ifdef ENABLE_WALLET
delete paymentServer;
paymentServer = nullptr;
delete m_wallet_controller;
m_wallet_controller = nullptr;
#endif
// Delete Qt-settings if user clicked on "Reset Options" // Delete Qt-settings if user clicked on "Reset Options"
QSettings settings; QSettings settings;
if(optionsModel && optionsModel->resetSettingsOnShutdown){ if(optionsModel && optionsModel->resetSettingsOnShutdown){
@ -344,24 +339,21 @@ void BitcoinApplication::initializeResult(bool success)
{ {
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
qInfo() << "Platform customization:" << gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM).c_str(); qInfo() << "Platform customization:" << gArgs.GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM).c_str();
#ifdef ENABLE_WALLET
m_wallet_controller = new WalletController(m_node, 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); clientModel = new ClientModel(m_node, optionsModel);
window->setClientModel(clientModel); window->setClientModel(clientModel);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (WalletModel::isWalletEnabled()) {
m_wallet_controller = new WalletController(m_node, optionsModel, this);
window->setWalletController(m_wallet_controller); 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
}
}
#endif // ENABLE_WALLET
// If -min option passed, start window minimized (iconified) or minimized to tray // If -min option passed, start window minimized (iconified) or minimized to tray
if (!gArgs.GetBoolArg("-min", false)) { if (!gArgs.GetBoolArg("-min", false)) {
@ -579,8 +571,10 @@ int GuiMain(int argc, char* argv[])
// Start up the payment server early, too, so impatient users that click on // Start up the payment server early, too, so impatient users that click on
// dash: links repeatedly have their payment requests routed to this process: // dash: links repeatedly have their payment requests routed to this process:
if (WalletModel::isWalletEnabled()) {
app.createPaymentServer(); app.createPaymentServer();
#endif }
#endif // ENABLE_WALLET
/// 9. Main GUI initialization /// 9. Main GUI initialization
// Install global event filter that makes sure that out-of-focus labels do not contain text cursor. // Install global event filter that makes sure that out-of-focus labels do not contain text cursor.