Improve block validity/ConnectBlock() comments #7444

pull petertodd wants to merge 1 commits into bitcoin:master from petertodd:2016-01-improve-block-validity-comments changing 1 files +14 −10
  1. petertodd commented at 5:45 am on January 31, 2016: contributor

    Previously didn’t make clear that the ContextualCheckBlock* functions meant the block headers as context - not the UTXO set itself - and that ConnectBlock() also did UTXO-related validity checks (in the future we may split that functionality into a separate UTXO-specific contextual check block function).

    Also, reordered to put validity checks first for better readability.

    Noticed this nit while reviewing #7184

  2. Improve block validity/ConnectBlock() comments
    Previously didn't make clear that the ContextualCheckBlock* functions
    meant the block headers as context - not the UTXO set itself - and that
    ConnectBlock() also did UTXO-related validity checks (in the future we
    may split that functionality into a separate UTXO-specific contextual
    check block function).
    
    Also, reordered to put validity checks first for better readability.
    2f19905324
  3. laanwj added the label Docs and Output on Feb 1, 2016
  4. laanwj commented at 9:33 am on February 1, 2016: member
    The reordering makes it harder to see what actually changed in the text :(
  5. MarcoFalke commented at 12:02 pm on February 1, 2016: member
    Maybe just do it without the reordering?
  6. petertodd commented at 4:22 am on February 2, 2016: contributor
    What can I say, it is just two actual non-comment lines changed. :)
  7. laanwj commented at 2:32 pm on February 2, 2016: member

    Yes, which would have been easier to see if the move and text change were separate commits.

    Anyhow, these are the text changes:

     0--- a/src/main.h
     1+++ b/src/main.h
     2@@ -413,14 +413,18 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus
     3  *  of problems. Note that in any case, coins may be modified. */
     4 bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);
     5
     6-/** Apply the effects of this block (with given index) on the UTXO set represented by coins */
     7+/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
     8+ *  Validity checks that depend on the UTXO set are also done; ConnectBlock()
     9+ *  can fail if those validity checks fail (among other reasons). */
    10 bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck = false);
    11
    12 /** Context-independent validity checks */
    13 bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW = true);
    14 bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
    15
    16-/** Context-dependent validity checks */
    17+/** Context-dependent validity checks.
    18+ *  By "context", we mean only the previous block headers, but not the UTXO
    19+ *  set; UTXO-related validity checks are done in ConnectBlock(). */
    20 bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex *pindexPrev);
    21 bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev);
    

    ACK https://github.com/petertodd/bitcoin/commit/2f19905324078e07d8c21b991ef010da80403d95

  8. sipa commented at 4:45 pm on February 2, 2016: member
    ACK
  9. petertodd commented at 6:02 pm on February 2, 2016: contributor
    @laanwj Fair enough; I’ll split changes like that into two commits in the future.
  10. laanwj merged this on Feb 3, 2016
  11. laanwj closed this on Feb 3, 2016

  12. laanwj referenced this in commit 4cdbd4255b on Feb 3, 2016
  13. codablock referenced this in commit 0b80c8189c on Sep 16, 2017
  14. codablock referenced this in commit 89b88c2c5c on Sep 19, 2017
  15. codablock referenced this in commit dfdf4bcf9c on Dec 9, 2017
  16. codablock referenced this in commit f16d8beffb on Dec 9, 2017
  17. codablock referenced this in commit 0f8ce56883 on Dec 11, 2017
  18. zkbot referenced this in commit 6dcc7dd6ce on Mar 9, 2018
  19. zkbot referenced this in commit b094b02c0b on Mar 10, 2018
  20. zkbot referenced this in commit 59ef0e4c9c on Mar 12, 2018
  21. zkbot referenced this in commit 6dfd4baa1a on Mar 12, 2018
  22. zkbot referenced this in commit 05132fdca8 on Apr 6, 2018
  23. zkbot referenced this in commit 5fefc451a7 on Apr 13, 2018
  24. zkbot referenced this in commit 4c91fbf1c7 on May 31, 2018
  25. lateminer referenced this in commit af95ba010d on Oct 23, 2018
  26. zkbot referenced this in commit 82d64f57c9 on Oct 24, 2018
  27. zkbot referenced this in commit 971f37e510 on Oct 25, 2018
  28. zkbot referenced this in commit 5b8b057c96 on Apr 5, 2019
  29. zkbot referenced this in commit a53fd12544 on Apr 9, 2019
  30. zkbot referenced this in commit fcf551eaaf on May 24, 2019
  31. zkbot referenced this in commit e25cb39033 on May 24, 2019
  32. zkbot referenced this in commit 3d37ebe9d8 on May 28, 2019
  33. 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: 2024-12-19 06:12 UTC

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