Add maximal amount-of-transactions limit to checkblock/CVerifyDB #8138

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/06/verify_db changing 4 files +21 −8
  1. jonasschnelli commented at 3:00 pm on June 2, 2016: contributor

    Reduces checkblocks default to 144 blocks (MIN_BLOCKS_TO_KEEP / 2).

    Introduce -checkmaxtx with a default of 100'000 transaction to set a upper bound of amount of transaction to check during the CVerifyDB process.

    There is also a new constant MIN_BLOCK_TO_RESPECT_WITH_MAX_TX_CHECK which defines the minimum amount of blocks to check even if the -checkmaxtx check has been fulfilled.

  2. Add maximal amount-of-transactions limit to checkblock/CVerifyDB 58af361855
  3. jonasschnelli added the label Validation on Jun 2, 2016
  4. dcousens commented at 3:11 pm on June 2, 2016: contributor

    Perhaps we should also reduce the number 288. Maybe a limit specified in number of transactions is better?

    Or perhaps a limit specified in size on disk? Last 288MB as an example.

  5. in src/main.cpp: in 58af361855
    3915@@ -3915,6 +3916,11 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
    3916         }
    3917         if (ShutdownRequested())
    3918             return true;
    3919+        nTxCheckLimitCurrent+=block.vtx.size();
    3920+        if (nTxCheckLimit > 0 && nTxCheckLimitCurrent >= nTxCheckLimit && chainActive.Height() - pindex->nHeight >= std::min(nCheckDepth, MIN_BLOCK_TO_RESPECT_WITH_MAX_TX_CHECK)) {
    


    sipa commented at 11:30 pm on June 2, 2016:
    The std::min isn’t necessary, as chainActive.Height() - pindex->nHeight will never exceed nCheckDepth (we bail out of the loop before that can happen).
  6. kazcw commented at 10:04 pm on June 5, 2016: contributor
    The relationship between -checkblocks and -checkmaxtx is not clear from the help text. It looks like as implemented it will stop when either limit is reached, modulo the MIN_BLOCK_TO_RESPECT_WITH_MAX_TX_CHECK logic (i.e. they are both maxes). Unless there’s a particular benefit to the max-based interface, I think I would prefer if they were both mins, which would also obviate MIN_BLOCK_TO_RESPECT_WITH_MAX_TX_CHECK.
  7. sipa commented at 12:08 pm on August 25, 2016: member

    You could also just get rid of MIN_BLOCK_TO_RESPECT_WITH_MAX_TX_CHECK. The theoretical maximum number of transactions in a block is 16665 anyway, so 100000 transactions effectively already requires 7 blocks anyway. If someone wants to set a lower number of transactions, so bit it.

    That would simplify this PR, and have clearer semantics.

  8. sipa commented at 3:44 pm on August 31, 2016: member
    Closing this as superseded by #8611.
  9. sipa closed this on Aug 31, 2016

  10. DrahtBot locked this on Sep 8, 2021

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: 2024-11-23 09:12 UTC

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