Skip to content

Commit 52f4d56

Browse files
committed
refactor: remove <util/system.h> include from wallet.h
Since we no longer store a ref to the global `ArgsManager` inside the wallet, we can move the util/system.h include to the cpp. This dependency removal opened a can of worms, as few other places were, invalidly, depending on the wallet's header including it.
1 parent 6c9b342 commit 52f4d56

File tree

7 files changed

+14
-2
lines changed

7 files changed

+14
-2
lines changed

src/qt/optionsmodel.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <netbase.h>
1919
#include <txdb.h> // for -dbcache defaults
2020
#include <util/string.h>
21+
#include <util/system.h>
2122
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
2223
#include <wallet/wallet.h> // For DEFAULT_SPEND_ZEROCONF_CHANGE
2324

@@ -640,6 +641,11 @@ bool OptionsModel::isRestartRequired() const
640641
return settings.value("fRestartRequired", false).toBool();
641642
}
642643

644+
bool OptionsModel::hasSigner()
645+
{
646+
return gArgs.GetArg("-signer", "") != "";
647+
}
648+
643649
void OptionsModel::checkAndMigrate()
644650
{
645651
// Migration of default values

src/qt/optionsmodel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class OptionsModel : public QAbstractListModel
9898
bool getEnablePSBTControls() const { return m_enable_psbt_controls; }
9999
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
100100

101+
/** Whether -signer was set or not */
102+
bool hasSigner();
103+
101104
/* Explicit setters */
102105
void SetPruneTargetGB(int prune_target_gb);
103106

src/qt/sendcoinsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
203203
if (model->wallet().hasExternalSigner()) {
204204
//: "device" usually means a hardware wallet.
205205
ui->sendButton->setText(tr("Sign on device"));
206-
if (gArgs.GetArg("-signer", "") != "") {
206+
if (model->getOptionsModel()->hasSigner()) {
207207
ui->sendButton->setEnabled(true);
208208
ui->sendButton->setToolTip(tr("Connect your hardware wallet first."));
209209
} else {

src/wallet/dump.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <wallet/dump.h>
66

77
#include <fs.h>
8+
#include <util/system.h>
89
#include <util/translation.h>
910
#include <wallet/wallet.h>
1011

src/wallet/rpc/util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <common/url.h>
88
#include <rpc/util.h>
9+
#include <util/system.h>
910
#include <util/translation.h>
1011
#include <wallet/context.h>
1112
#include <wallet/wallet.h>

src/wallet/wallet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <util/moneystr.h>
3535
#include <util/rbf.h>
3636
#include <util/string.h>
37+
#include <util/system.h>
3738
#include <util/translation.h>
3839
#include <wallet/coincontrol.h>
3940
#include <wallet/context.h>

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <fs.h>
1111
#include <interfaces/chain.h>
1212
#include <interfaces/handler.h>
13+
#include <logging.h>
1314
#include <outputtype.h>
1415
#include <policy/feerate.h>
1516
#include <psbt.h>
@@ -19,7 +20,6 @@
1920
#include <util/result.h>
2021
#include <util/strencodings.h>
2122
#include <util/string.h>
22-
#include <util/system.h>
2323
#include <util/time.h>
2424
#include <util/ui_change_type.h>
2525
#include <validationinterface.h>

0 commit comments

Comments
 (0)