[trivial] Fix -maxmempool InitError #7069

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:MarcoFalke-2015-maxmempoolInitError changing 1 files +5 −5
  1. MarcoFalke commented at 1:27 PM on November 20, 2015: member

    -maxmempool is integer so we need to pass std::ceil( $minimum )

  2. jonasschnelli commented at 1:33 PM on November 20, 2015: contributor

    Was also stumpling over that issue. utACK.

  3. dcousens commented at 4:40 PM on November 20, 2015: contributor

    utACK

  4. in src/init.cpp:None in cbd46c0655 outdated
     878 | @@ -879,7 +879,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
     879 |      int64_t nMempoolSizeLimit = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
     880 |      int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000;
     881 |      if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit * 40)
     882 | -        return InitError(strprintf(_("-maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
     883 | +        return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25.0)));
    


    laanwj commented at 10:27 AM on November 24, 2015:

    I don't like repeating the computation here in a different form. This is bound to give inconsistencies when it is changed later. Can we do

    int64_t mempoolSizeLimitMin = nMempoolDescendantSizeLimit * 40;
    if (nMempoolSizeLimit < nMempoolSizeLimitMin)
        return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(mempoolSizeLimitMin / 1000.0)));
    
  5. MarcoFalke force-pushed on Nov 24, 2015
  6. in src/init.cpp:None in fa65c353b1 outdated
     876 | @@ -877,9 +877,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
     877 |  
     878 |      // -mempoollimit limits
     879 |      int64_t nMempoolSizeLimit = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
     880 | -    int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000;
     881 | -    if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit * 40)
     882 | -        return InitError(strprintf(_("-maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
     883 | +    int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
     884 | +    if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit)
    


    laanwj commented at 11:00 AM on November 24, 2015:

    Can nMempoolDescendantSizeLimit be (usefully) negative? Otherwise it makes little sense to compare against both 0 and that value.

  7. MarcoFalke force-pushed on Nov 24, 2015
  8. MarcoFalke force-pushed on Nov 24, 2015
  9. [trivial] Fix -maxmempool InitError fa472f330f
  10. MarcoFalke force-pushed on Nov 24, 2015
  11. in src/init.cpp:None in fa472f330f
     880 | -    int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000;
     881 | -    if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit * 40)
     882 | -        return InitError(strprintf(_("-maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
     883 | +    // mempool limits
     884 | +    int64_t nMempoolSizeMax = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
     885 | +    int64_t nMempoolSizeMin = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
    


    laanwj commented at 10:18 AM on November 26, 2015:

    Variable name nMemPoolSizeMin is not entirely correct as this is the minimum for the maximum mempool size, not the minimum mempool size (which would be non-sensical). Anyhow, not important enough to dwell on I guess.

  12. laanwj merged this on Nov 26, 2015
  13. laanwj closed this on Nov 26, 2015

  14. laanwj referenced this in commit f8a8e27a6a on Nov 26, 2015
  15. paveljanik commented at 3:30 PM on November 27, 2015: contributor

    Hmm:

    master/src pavel$ ./bitcoind - -maxmempool=4
    Error: -maxmempool must be at least 4040 MB
    master/src pavel$ 
    

    and 5 is OK? /1000000.0 instead of 1000.0?

  16. paveljanik commented at 3:38 PM on November 27, 2015: contributor

    I'll PR the fix.

  17. MarcoFalke deleted the branch on Nov 28, 2015
  18. MarcoFalke 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: 2026-04-17 06:15 UTC

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