Add -stopatheight for benchmarking #10290

pull sipa wants to merge 1 commits into bitcoin:master from sipa:shutdown_at_height changing 3 files +8 −0
  1. sipa commented at 7:28 PM on April 27, 2017: member

    This is similar to -stopafterimport, but easier to use for repeated benchmarks.

  2. Add -stopatheight for benchmarking b297426c96
  3. sipa force-pushed on Apr 27, 2017
  4. in src/validation.cpp:2541 in b297426c96
    2536 | @@ -2537,6 +2537,9 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
    2537 |          return false;
    2538 |      }
    2539 |  
    2540 | +    int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
    2541 | +    if (nStopAtHeight && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
    


    practicalswift commented at 10:26 PM on April 27, 2017:

    Is pindexNewTip != NULL guaranteed here?


    kallewoof commented at 8:16 AM on April 28, 2017:

    It is guaranteed non-null beyond line 2512, which is guaranteed to execute unless the function returns at line 2501 or 2506.


    TheBlueMatt commented at 3:17 PM on April 28, 2017:

    No, I dont believe so, in a crazy case you may have started shutdown (possibly due to stopatheight), and then gotten another call into ActivateBestChain(), which will break out of the main loop at the first chance it gets, and then blow up.


    kallewoof commented at 3:45 PM on April 28, 2017:

    Yes, line 2486. I missed that somehow. pindexNewTip is not guaranteed non-null. Sorry about misleading response.

  5. fanquake commented at 11:05 PM on April 27, 2017: member

    Concept ACK. Will test.

    On Fri, 28 Apr 2017 at 06:26, practicalswift notifications@github.com wrote:

    @practicalswift commented on this pull request.

    In src/validation.cpp https://github.com/bitcoin/bitcoin/pull/10290#discussion_r113816919:

    @@ -2537,6 +2537,9 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, return false; }

    • int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
    • if (nStopAtHeight && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();

    Is pindexNewTip != NULL guaranteed here?

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/10290#pullrequestreview-35239348, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0t8gxZAtoKmYXr-a0xAB_nk0lIzx1Cks5r0RYogaJpZM4NKqhz .

  6. in src/init.cpp:439 in b297426c96
     435 | @@ -436,6 +436,8 @@ std::string HelpMessage(HelpMessageMode mode)
     436 |          strUsage += HelpMessageOpt("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages");
     437 |          strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", "Randomly fuzz 1 of every <n> network messages");
     438 |          strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", DEFAULT_STOPAFTERBLOCKIMPORT));
     439 | +        strUsage += HelpMessageOpt("-stopatheight", strprintf("Stop running after reaching the given height in the main chain (default: %u)", DEFAULT_STOPATHEIGHT));
    


    jtimon commented at 1:09 PM on April 28, 2017:

    Perhaps explain that with 0 it won't do anything? Also, this is not only for the main chain, it will work with testnet3 and regtest right?


    MarcoFalke commented at 12:39 PM on April 29, 2017:

    It's a debug option, so the user can figure out that -nostopatheight won't do anything?

  7. jtimon commented at 1:10 PM on April 28, 2017: contributor

    utACK b297426c9670fa83a12096f9db5666c15e1bb806

  8. laanwj merged this on May 1, 2017
  9. laanwj closed this on May 1, 2017

  10. laanwj referenced this in commit 8d6d43e933 on May 1, 2017
  11. TheBlueMatt referenced this in commit 70d39454ee on May 1, 2017
  12. luke-jr referenced this in commit e3b11582c9 on Jun 15, 2017
  13. luke-jr referenced this in commit 2f78b8adc4 on Jun 15, 2017
  14. CryptAxe referenced this in commit c7317ce9c0 on Jun 20, 2017
  15. sipa deleted the branch on Jun 23, 2017
  16. HashUnlimited referenced this in commit 21e8253830 on Mar 2, 2018
  17. dagurval referenced this in commit f9ed75dcb0 on May 9, 2018
  18. dagurval referenced this in commit 268ddda6ce on May 11, 2018
  19. PastaPastaPasta referenced this in commit 17da857801 on Jun 10, 2019
  20. PastaPastaPasta referenced this in commit 537dc0f38c on Jun 10, 2019
  21. PastaPastaPasta referenced this in commit 477fd58dfa on Jun 11, 2019
  22. PastaPastaPasta referenced this in commit 0740da6f06 on Jun 11, 2019
  23. PastaPastaPasta referenced this in commit e9a0f68009 on Jun 12, 2019
  24. PastaPastaPasta referenced this in commit 74d03df130 on Jun 14, 2019
  25. PastaPastaPasta referenced this in commit c53f581630 on Jun 14, 2019
  26. PastaPastaPasta referenced this in commit 0326e21a80 on Jun 14, 2019
  27. PastaPastaPasta referenced this in commit 661b92898e on Jun 15, 2019
  28. PastaPastaPasta referenced this in commit b1f602bbd6 on Jun 19, 2019
  29. barrystyle referenced this in commit 0adb35028d on Jan 22, 2020
  30. 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-19 09:15 UTC

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