Skip to content

Commit 2a84c6b

Browse files
committed
GUI/Intro: Estimate max age of backups that can be restored with pruning
1 parent e2dcd95 commit 2a84c6b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/qt/forms/intro.ui

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@
219219
</property>
220220
</widget>
221221
</item>
222+
<item>
223+
<widget class="QLabel" name="lblPruneSuffix">
224+
<property name="buddy">
225+
<cstring>pruneGB</cstring>
226+
</property>
227+
</widget>
228+
</item>
222229
<item>
223230
<spacer name="horizontalSpacer_2">
224231
<property name="orientation">

src/qt/intro.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
148148
}
149149
ui->pruneGB->setValue(m_prune_target_gb);
150150
ui->pruneGB->setToolTip(ui->prune->toolTip());
151+
ui->lblPruneSuffix->setToolTip(ui->prune->toolTip());
151152
UpdatePruneLabels(ui->prune->isChecked());
152153

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

0 commit comments

Comments
 (0)