Document assumptions made in PeerLogicValidation::SendMessages(...) and rescanblockchain(...) #13548

pull practicalswift wants to merge 2 commits into bitcoin:master from practicalswift:document-non-nullptr-assumptions changing 2 files +3 −0
  1. practicalswift commented at 4:46 PM on June 27, 2018: contributor

    Document assumptions made in PeerLogicValidation::SendMessages(...) and rescanblockchain(...) via assertions.

    The fact that pBestIndex != nullptr and stopBlock != nullptr in these contexts is not immediately obvious. Explicit is better than implicit.

  2. Document assumption made about pBestIndex in PeerLogicValidation::SendMessages(...) e30ef3e521
  3. Document assumption made about stopBlock in rescanblockchain(...) a7946bc261
  4. fanquake added the label Refactoring on Jun 27, 2018
  5. MarcoFalke closed this on Aug 17, 2018

  6. MarcoFalke reopened this on Aug 17, 2018

  7. promag commented at 4:00 PM on August 17, 2018: member

    is not immediately obvious. Explicit is better than implicit.

    I don't agree, it's obvious because they are used right after the assertions.

  8. practicalswift commented at 4:36 PM on August 17, 2018: contributor

    @promag Yes, but the assertion documents that the dereference without a prior null check is intentional and not just an oversight. That helps static analyzers and human reviewers, don’t you agree? :-)

    FWIW I’ve seen numerous static analyzers independently flag these specific cases (and the cases covered by the other similar assertion PR:s). I’m not just adding asserts randomly for fun :-)

  9. practicalswift cross-referenced this on Aug 31, 2018 from issue wallet: Remove unused local variable old_label by practicalswift
  10. DrahtBot cross-referenced this on Sep 17, 2018 from issue Remove unnamed block in SendMessages function by kostyantyn
  11. DrahtBot commented at 4:15 PM on September 17, 2018: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->No more conflicts as of last run.

  12. practicalswift closed this on Oct 18, 2018

  13. ajtowns cross-referenced this on Oct 15, 2020 from issue Make Assert(…) usable in all contexts. Make implicit assumptions explicit. by practicalswift
  14. practicalswift deleted the branch on Apr 10, 2021
  15. bitcoin locked this on Aug 16, 2022

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