Merge bitcoin/bitcoin#35948: init: correct first-run disk space estimate
What changed, and why it matters
This change fixes a labeling bug in Bitcoin Core's first-run disk-space warning. The estimate was stored in GiB (binary gigabytes, 1024-based) but displayed as GB (decimal gigabytes, 1000-based), and for pruned nodes it showed the full-chain size instead of the smaller pruned size. The patch corrects the label to GiB and shows the same rounded-up value that the actual disk-space check uses. There is no security vulnerability here.
No security action needed. Treat as a normal UI/labeling fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit updates src/init.cpp and src/kernel/chainparams.h. It changes the first-run disk-space warning string from ‘Approximately %u GB’ to ‘Approximately %u GiB’ and replaces chainparams.AssumedBlockchainSize() with CeilDiv(additional_bytes_needed, 1_GiB), so the displayed estimate matches the value used in the CheckDiskSpace() call. It also updates comments in chainparams.h to document that AssumedBlockchainSize() and AssumedChainStateSize() are in GiB. This is a UI/labeling consistency fix with no code path that affects consensus, networking, cryptography, or resource limits beyond the warning text.
Changed components
src/init.cpp first-run disk-space warning messagesrc/kernel/chainparams.h documentation comments for AssumedBlockchainSize and AssumedChainStateSizeInspect captured patch +5 / −4
### src/init.cpp
@@ -92,6 +92,7 @@
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/moneystr.h>
+#include <util/overflow.h>
#include <util/result.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
@@ -2045,10 +2046,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
InitWarning(strprintf(_(
"Disk space for %s may not accommodate the block files. " \
- "Approximately %u GB of data will be stored in this directory."
+ "Approximately %u GiB of data will be stored in this directory."
),
fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
- chainparams.AssumedBlockchainSize()
+ CeilDiv(additional_bytes_needed, 1_GiB)
));
}
}
### src/kernel/chainparams.h
@@ -99,9 +99,9 @@ class CChainParams
/** If this chain allows time to be mocked */
bool IsMockableChain() const { return m_is_mockable_chain; }
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
- /** Minimum free space (in GB) needed for data directory */
+ /** Minimum free space (in GiB) needed for data directory */
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
- /** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
+ /** Minimum free space (in GiB) needed for data directory when pruned; Does not include prune target*/
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
/** Whether it is possible to mine blocks on demand (no retargeting) */
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.