rpc: Clarify pblock assumption via an assertion #10638

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:nnonce changing 1 files +1 −0
  1. practicalswift commented at 9:26 PM on June 20, 2017: contributor

    pblock->nNonce = 0 will result in a nullptr dereference if the added assertion does not hold true.

    pblock != nullptr is not obvious from reading the code - hence the need for stating this assumption explicitly via an assertion. This has the added benefit getting rid of the following clang-tidy warning:

    rpc/mining.cpp:560:20: note: Access to field 'nNonce' results in
      a dereference of a null pointer (loaded from variable 'pblock')
        pblock->nNonce = 0;
    
  2. fanquake added the label RPC/REST/ZMQ on Jun 20, 2017
  3. practicalswift force-pushed on Aug 9, 2017
  4. practicalswift commented at 12:46 PM on January 31, 2018: contributor

    Anyone willing to review? :-)

  5. Clarify pblock assumption via an assertion
    pblock->nNonce = 0 will result in a nullptr dereference if the
    added assertion does not hold true.
    
    pblock != nullptr is not obvious from reading the code - hence
    the need for stating this assumption explicitly via an assertion.
    This has the added benefit getting rid of the following clang-tidy
    warning:
    
    rpc/mining.cpp:560:20: note: Access to field 'nNonce' results in
      a dereference of a null pointer (loaded from variable 'pblock')
        pblock->nNonce = 0;
    4ec3d98730
  6. practicalswift force-pushed on Mar 9, 2018
  7. practicalswift renamed this:
    [rpc] Clarify pblock assumption via an assertion
    rpc: Clarify pblock assumption via an assertion
    on Mar 19, 2018
  8. practicalswift commented at 3:09 PM on March 27, 2018: contributor

    Seems to be consensus NACK on this one. Closing :-)

  9. practicalswift closed this on Mar 27, 2018

  10. practicalswift deleted the branch on Apr 10, 2021
  11. DrahtBot locked this on Aug 18, 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-13 15:15 UTC

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