doc: Correct comments re. units of constants #25299

pull Empact wants to merge 2 commits into bitcoin:master from Empact:2022-06-prune-target changing 2 files +2 −2
  1. Empact commented at 10:13 PM on June 7, 2022: member

    In #15848, darosior fixed up a comment which mis-identified the units of a constant.

    Another comment misidentified a value as in MiB rather than MB.

  2. doc: Correct nPruneTarget misidentifying units of variable 64f81a38b9
  3. doc: Correct comment describing value of MAX_FILE_SIZE_PSBT as in MiB
    100 MiB is 100 * (10224 ** 2), or 107,374,182,400 bytes.
    241c4d047e
  4. DrahtBot added the label Block storage on Jun 7, 2022
  5. in src/node/blockstorage.h:53 in 241c4d047e
      48 | @@ -49,7 +49,7 @@ extern std::atomic_bool fReindex;
      49 |  /** Pruning-related variables and constants */
      50 |  /** True if we're running in -prune mode. */
      51 |  extern bool fPruneMode;
      52 | -/** Number of MiB of block files that we're trying to stay below. */
      53 | +/** Number of bytes of block files that we're trying to stay below. */
      54 |  extern uint64_t nPruneTarget;
    


    laanwj commented at 5:58 PM on June 8, 2022:

    I've checked and indeed, this value is in bytes. The -prune option is in MiB, but it's multiplied with 1024*1024 before being stored here.

  6. in src/psbt.h:57 in 241c4d047e
      53 | @@ -54,7 +54,7 @@ static constexpr uint8_t PSBT_SEPARATOR = 0x00;
      54 |  
      55 |  // BIP 174 does not specify a maximum file size, but we set a limit anyway
      56 |  // to prevent reading a stream indefinitely and running out of memory.
      57 | -const std::streamsize MAX_FILE_SIZE_PSBT = 100000000; // 100 MiB
      58 | +const std::streamsize MAX_FILE_SIZE_PSBT = 100000000; // 100 MB
    


    laanwj commented at 6:02 PM on June 8, 2022:

    These kind of comments are really asking to go out of sync, would be fine with removing it as well. Would using C++14 digit separators be an idea maybe? 100'000'000?


    Empact commented at 6:14 AM on June 16, 2022:

    My preference would be to use constants like this one to make the code equivalent to this documentation: const std::streamsize MAX_FILE_SIZE_PSBT = 100 * MB_BYTES; though I suppose you could possibly type MIB vs MB there too.

  7. darosior commented at 8:18 PM on June 9, 2022: member

    ACK 241c4d047ee658a976625c39c6acd04dd7b071ef, with or without #25299 (review)

  8. laanwj commented at 7:46 PM on June 17, 2022: member

    Code review ACK 241c4d047ee658a976625c39c6acd04dd7b071ef

  9. laanwj merged this on Jun 17, 2022
  10. laanwj closed this on Jun 17, 2022

  11. MarcoFalke removed the label Block storage on Jun 18, 2022
  12. MarcoFalke added the label Docs on Jun 18, 2022
  13. sidhujag referenced this in commit 4c904c5899 on Jun 19, 2022
  14. DrahtBot locked this on Jun 18, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me