Trivial: Segwit: Don't call IsWitnessEnabled from ContextualCheckBlock #8348

pull jtimon wants to merge 1 commits into bitcoin:master from jtimon:0.12.99-consensus-segwit changing 1 files +1 −1
  1. jtimon commented at 12:49 AM on July 17, 2016: contributor

    IsWitnessEnabled() should not be called from libconsensus code, only from outside what's already encapsulated. The 3 callers already AssertLockHeld(cs_main);, this is my grep:

    ./src/main.h:448:bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev);
    ./src/main.cpp:3525:bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex * const pindexPrev)
    ./src/main.cpp:3602:        return state.DoS(100, error("ContextualCheckBlock(): cost limit failed"), REJECT_INVALID, "bad-blk-cost");
    ./src/main.cpp:3689:    if ((!CheckBlock(block, state, chainparams.GetConsensus(), GetAdjustedTime())) || !ContextualCheckBlock(block, state, pindex->pprev)) {
    ./src/main.cpp:3780:    if (!ContextualCheckBlock(block, state, pindexPrev))
    

    I could have said this during segwit review instead of now, sorry @sipa.

  2. Trivial: Segwit: Don't call IsWitnessEnabled from ContextualCheckBlock 38c4c8b701
  3. jonasschnelli added the label Refactoring on Jul 17, 2016
  4. NicolasDorier commented at 1:00 PM on July 21, 2016: contributor

    utACK 38c4c8b7012ceeee3b6591d6a80b5f13ee20fbd6

  5. btcdrak commented at 1:33 PM on July 21, 2016: contributor

    utACK 38c4c8b

  6. MarcoFalke commented at 1:40 PM on July 21, 2016: member

    utACK 38c4c8b

  7. laanwj commented at 7:50 AM on July 28, 2016: member
  8. laanwj merged this on Jul 28, 2016
  9. laanwj closed this on Jul 28, 2016

  10. laanwj referenced this in commit 64d660a43f on Jul 28, 2016
  11. JeremyRubin cross-referenced this on Mar 29, 2017 from issue Consensus: use IsWitnessEnabled in ContextualCheckBlock by roconnor-blockstream
  12. bitcoin 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-05-20 06:55 UTC