GUI/Intro: Estimate max age of backups that can be restored with pruning

pull/826/head
Luke Dashjr 5 years ago
parent e2dcd957fa
commit 2a84c6bcf6

@ -219,6 +219,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="lblPruneSuffix">
<property name="buddy">
<cstring>pruneGB</cstring>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">

@ -148,6 +148,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
} }
ui->pruneGB->setValue(m_prune_target_gb); ui->pruneGB->setValue(m_prune_target_gb);
ui->pruneGB->setToolTip(ui->prune->toolTip()); ui->pruneGB->setToolTip(ui->prune->toolTip());
ui->lblPruneSuffix->setToolTip(ui->prune->toolTip());
UpdatePruneLabels(ui->prune->isChecked()); UpdatePruneLabels(ui->prune->isChecked());
connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) { connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) {
@ -381,6 +382,10 @@ void Intro::UpdatePruneLabels(bool prune_checked)
} }
ui->lblExplanation3->setVisible(prune_checked); ui->lblExplanation3->setVisible(prune_checked);
ui->pruneGB->setEnabled(prune_checked); ui->pruneGB->setEnabled(prune_checked);
static constexpr uint64_t nPowTargetSpacing = 10 * 60; // from chainparams, which we don't have at this stage
static constexpr uint32_t expected_block_data_size = 2250000; // includes undo data
const uint64_t expected_backup_days = m_prune_target_gb * 1e9 / (uint64_t(expected_block_data_size) * 86400 / nPowTargetSpacing);
ui->lblPruneSuffix->setText(tr("(sufficient to restore backups %n day(s) old)", "block chain pruning", expected_backup_days));
ui->sizeWarningLabel->setText( ui->sizeWarningLabel->setText(
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " + tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " +
storageRequiresMsg.arg(m_required_space_gb) + " " + storageRequiresMsg.arg(m_required_space_gb) + " " +

Loading…
Cancel
Save