Rename CalculateHeadersWork to CalculateClaimedHeadersWork #29569

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:2024-03-claimed_work changing 4 files +9 −9
  1. instagibbs commented at 3:07 PM on March 5, 2024: member

    And clean up some comments. Confusion about what this is doing seems to be a running theme:

    #29549 (review)

    #27278 (review)

  2. Rename CalculateHeadersWork to CalculateClaimedHeadersWork eb7cc9fd21
  3. DrahtBot commented at 3:07 PM on March 5, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. pablomartin4btc commented at 5:34 PM on March 5, 2024: member

    ACK eb7cc9fd2140df77acc6eb42004cf45b260bc629

  5. in src/net_processing.cpp:4749 in eb7cc9fd21
    4743 | @@ -4744,8 +4744,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
    4744 |              // cs_main in ProcessNewBlock is fine.
    4745 |              mapBlockSource.emplace(hash, std::make_pair(pfrom.GetId(), true));
    4746 |  
    4747 | -            // Check work on this block against our anti-dos thresholds.
    4748 | -            if (prev_block && prev_block->nChainWork + CalculateHeadersWork({pblock->GetBlockHeader()}) >= GetAntiDoSWorkThreshold()) {
    4749 | +            // Check claimed work on this block against our anti-dos thresholds.
    4750 | +            if (prev_block && prev_block->nChainWork + CalculateClaimedHeadersWork({pblock->GetBlockHeader()}) >= GetAntiDoSWorkThreshold()) {
    4751 |                  min_pow_checked = true;
    


    0xB10C commented at 8:44 AM on March 6, 2024:

    nit: I also found min_pow_checked confusing. At least I read "PoW checked" at first.


    instagibbs commented at 7:17 PM on March 6, 2024:

    agreed it's also confusing, but it's also called that down the call stack for a bit, so I kept scope to here

  6. 0xB10C approved
  7. 0xB10C commented at 8:48 AM on March 6, 2024: contributor

    ACK eb7cc9fd2140df77acc6eb42004cf45b260bc629

    I misinterpreted CalculateHeadersWork - CalculateClaimedHeadersWork is a bit clearer.

  8. dergoegge approved
  9. dergoegge commented at 9:24 AM on March 6, 2024: member

    ACK eb7cc9fd2140df77acc6eb42004cf45b260bc629

  10. BrandonOdiwuor approved
  11. BrandonOdiwuor commented at 4:08 PM on March 8, 2024: contributor

    ACK eb7cc9fd2140df77acc6eb42004cf45b260bc629

  12. achow101 commented at 2:31 AM on March 9, 2024: member

    ACK eb7cc9fd2140df77acc6eb42004cf45b260bc629

  13. achow101 merged this on Mar 9, 2024
  14. achow101 closed this on Mar 9, 2024

  15. bitcoin locked this on Mar 9, 2025

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-27 03:13 UTC

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