Skip to content

Commit d7c2c95

Browse files
ryanofskyjnewbery
authored andcommitted
Remove direct bitcoin calls from qt/intro.cpp
1 parent fe6f27e commit d7c2c95

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/interface/node.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class NodeImpl : public Node
113113
LOCK(::cs_main);
114114
tip = ::chainActive.Tip();
115115
}
116-
return GuessVerificationProgress(::Params().TxData(), tip);
116+
return GuessVerificationProgress(Params().TxData(), tip);
117117
}
118118
bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }
119119
bool getReindex() override { return ::fReindex; }
@@ -166,15 +166,15 @@ class NodeImpl : public Node
166166
{
167167
return MakeHandler(::uiInterface.NotifyBlockTip.connect([fn](bool initial_download, const CBlockIndex* block) {
168168
fn(initial_download, block->nHeight, block->GetBlockTime(),
169-
GuessVerificationProgress(::Params().TxData(), block));
169+
GuessVerificationProgress(Params().TxData(), block));
170170
}));
171171
}
172172
std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) override
173173
{
174174
return MakeHandler(
175175
::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) {
176176
fn(initial_download, block->nHeight, block->GetBlockTime(),
177-
GuessVerificationProgress(::Params().TxData(), block));
177+
GuessVerificationProgress(Params().TxData(), block));
178178
}));
179179
}
180180
};

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ int main(int argc, char *argv[])
602602

603603
/// 5. Now that settings and translations are available, ask user for data directory
604604
// User language is set up: pick a data directory
605-
if (!Intro::pickDataDirectory())
605+
if (!Intro::pickDataDirectory(*node))
606606
return EXIT_SUCCESS;
607607

608608
/// 6. Determine availability of data and blocks directory and parse bitcoin.conf

src/qt/intro.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <qt/guiutil.h>
1414

15+
#include <interface/node.h>
1516
#include <util.h>
1617

1718
#include <QFileDialog>
@@ -186,7 +187,7 @@ QString Intro::getDefaultDataDirectory()
186187
return GUIUtil::boostPathToQString(GetDefaultDataDir());
187188
}
188189

189-
bool Intro::pickDataDirectory()
190+
bool Intro::pickDataDirectory(interface::Node& node)
190191
{
191192
QSettings settings;
192193
/* If data directory provided on command line, no need to look at settings
@@ -233,8 +234,9 @@ bool Intro::pickDataDirectory()
233234
* override -datadir in the bitcoin.conf file in the default data directory
234235
* (to be consistent with bitcoind behavior)
235236
*/
236-
if(dataDir != getDefaultDataDirectory())
237-
gArgs.SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
237+
if(dataDir != getDefaultDataDirectory()) {
238+
node.softSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
239+
}
238240
return true;
239241
}
240242

src/qt/intro.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ static const bool DEFAULT_CHOOSE_DATADIR = false;
1313

1414
class FreespaceChecker;
1515

16+
namespace interface {
17+
class Node;
18+
}
19+
1620
namespace Ui {
1721
class Intro;
1822
}
@@ -41,7 +45,7 @@ class Intro : public QDialog
4145
* @note do NOT call global GetDataDir() before calling this function, this
4246
* will cause the wrong path to be cached.
4347
*/
44-
static bool pickDataDirectory();
48+
static bool pickDataDirectory(interface::Node& node);
4549

4650
/**
4751
* Determine default data directory for operating system.

0 commit comments

Comments
 (0)