Skip to content

Welcome screen uses GiB values as GB, risking running out of space #821

@BenWestgate

Description

@BenWestgate

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

The welcome screen correctly displays "55 GB of space available" while my system has 54322808 bytes available.

But it incorrectly says "... 12 GB of data will be stored in this directory" or "610 GB of data" if I uncheck the 2GB pruning. The values it is adding and comparing do not have the same unit. One is a GUI prune setting and/or space available in GB, the other is actually GiB: https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#how-to-calculate-m_assumed_blockchain_size-and-m_assumed_chain_state_size

Since the "how to calculate m_assumed ... size" instructions add a 5-10% buffer, what we display when only a 5-7% buffer is added to the values used in our GUI's space calculations will be too small and may lead to the user running out of space without being warned by the red text XXX GB of space available (of XXX GB needed).

Expected behaviour

The Welcome dialog should either use all GB or all GiB for its math. That way it never underestimates the space needed.
Converting the assumed_chain_state and assumed_blockchain_size to GB is a matter of multiplying by 1.073741824 and rounding up to the nearest GB.

That would update the values I was shown to: 13 GB and 655 GB respectively. You can see the gap between GB & GiB has gotten too massive to ignore, especially when estimating -prune=0 space needed.

Alternatively the units could be switched to GiB and my space available reported as 52 GiB and my prune setting bumped up to be 2 GiB (making it easier to predict what the GUI will show because the -prune command takes MiB).

I believe GB was used as it is the more familiar unit and matches what the OS and storage manufacturers tend to display so lets apply the first solution. Or update the https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#how-to-calculate-assumed-blockchain-and-chain-state-size
doc to require using a 13-19% buffer to allow for the previous 5-10% when they are misused as GB values despite being calculated as GiB.

Steps to reproduce

bitcoin-qt -choosedatadir notice the addition and subtraction of values that have different units as per our docs.

Relevant log output

No response

How did you obtain Bitcoin Core

Pre-built binaries

What version of Bitcoin Core are you using?

master / 27.0

Operating system and version

Debian 12

Machine specifications

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions