-
Notifications
You must be signed in to change notification settings - Fork 36.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Qt] implements concept for different disk sizes on intro #13216
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,6 @@ | |
#include <cmath> | ||
|
||
static const uint64_t GB_BYTES = 1000000000LL; | ||
/* Minimum free space (in GB) needed for data directory */ | ||
constexpr uint64_t BLOCK_CHAIN_SIZE = 220; | ||
/* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */ | ||
static const uint64_t CHAIN_STATE_SIZE = 3; | ||
/* Total required space (in GB) depending on user choice (prune, not prune) */ | ||
static uint64_t requiredSpace; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please note that |
||
|
||
|
@@ -114,26 +110,28 @@ void FreespaceChecker::check() | |
} | ||
|
||
|
||
Intro::Intro(QWidget *parent) : | ||
Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_size) : | ||
QDialog(parent), | ||
ui(new Ui::Intro), | ||
thread(0), | ||
signalled(false) | ||
signalled(false), | ||
m_blockchain_size(blockchain_size), | ||
m_chain_state_size(chain_state_size) | ||
{ | ||
ui->setupUi(this); | ||
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME))); | ||
ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME))); | ||
|
||
ui->lblExplanation1->setText(ui->lblExplanation1->text() | ||
.arg(tr(PACKAGE_NAME)) | ||
.arg(BLOCK_CHAIN_SIZE) | ||
.arg(m_blockchain_size) | ||
.arg(2009) | ||
.arg(tr("Bitcoin")) | ||
); | ||
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(tr(PACKAGE_NAME))); | ||
|
||
uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0)); | ||
requiredSpace = BLOCK_CHAIN_SIZE; | ||
requiredSpace = m_blockchain_size; | ||
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time."); | ||
if (pruneTarget) { | ||
uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES); | ||
|
@@ -145,7 +143,7 @@ Intro::Intro(QWidget *parent) : | |
} else { | ||
ui->lblExplanation3->setVisible(false); | ||
} | ||
requiredSpace += CHAIN_STATE_SIZE; | ||
requiredSpace += m_chain_state_size; | ||
ui->sizeWarningLabel->setText( | ||
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(tr(PACKAGE_NAME)) + " " + | ||
storageRequiresMsg.arg(requiredSpace) + " " + | ||
|
@@ -201,8 +199,15 @@ bool Intro::pickDataDirectory(interfaces::Node& node) | |
|
||
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false)) | ||
{ | ||
/* Use selectParams here to guarantee Params() can be used by node interface */ | ||
try { | ||
node.selectParams(gArgs.GetChainName()); | ||
} catch (const std::exception&) { | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this will hide all error messages from |
||
} | ||
|
||
/* If current default data directory does not exist, let the user choose one */ | ||
Intro intro; | ||
Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is another PR for this okay? |
||
intro.setDataDirectory(dataDir); | ||
intro.setWindowIcon(QIcon(":icons/bitcoin")); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be 220?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted, thanks! This was 200 when the PR was first made but changed down the line with this maintenance for 0.17: 78dae8c. Do you think this should be addressed here or could wait for the next maintenance (since the release process now asks for this to be changed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could bump it to 240 before 0.18 is branched, so we don't forget about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks. Like this? -> #15183