mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
[util] Avoid integer overflow in CheckDiskSpace
This commit is contained in:
parent
40c6c85c05
commit
4517419628
1 changed files with 3 additions and 2 deletions
|
@ -1631,10 +1631,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
// On first startup, warn on low block storage space
|
||||
if (!fReindex && !fReindexChainState && chain_active_height <= 1) {
|
||||
uint64_t assumed_chain_bytes{chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
|
||||
uint64_t additional_bytes_needed{
|
||||
chainman.m_blockman.IsPruneMode() ?
|
||||
chainman.m_blockman.GetPruneTarget() :
|
||||
chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
|
||||
std::min(chainman.m_blockman.GetPruneTarget(), assumed_chain_bytes) :
|
||||
assumed_chain_bytes};
|
||||
|
||||
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
|
||||
InitWarning(strprintf(_(
|
||||
|
|
Loading…
Add table
Reference in a new issue