ProcessHeadersMessage() fix potential bug #19505

pull Mr-Leshiy wants to merge 1 commits into bitcoin:master from Mr-Leshiy:ProcessHeadersMessage/fix_bug changing 1 files +2 −4
  1. Mr-Leshiy commented at 12:17 PM on July 13, 2020: contributor

    It seems that this part of code can produce assertion fails

    assert(pindexLast); // line 1819
    

    Because inside function ProcessNewBlockHeaders is invoked AcceptBlockHeader function that potentially can return only 'error' and doesn`t set 'state' variable in the invalid state.

    Here is the code of the AcceptBlockHeader

     if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))
                return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), state.ToString());
    
    if (!CheckBlockHeader(block, state, chainparams.GetConsensus()))
                return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, hash.ToString(), state.ToString());
    
  2. fix 073aa22b36
  3. Mr-Leshiy closed this on Jul 13, 2020

  4. Mr-Leshiy deleted the branch on Jul 13, 2020
  5. DrahtBot locked this on Feb 15, 2022
Contributors

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-22 00:14 UTC

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