Pow: Introduce MaybeGenerateProof #10669

pull jtimon wants to merge 1 commits into bitcoin:master from jtimon:b14-pow-maybe-prove changing 3 files +20 −10
  1. jtimon commented at 8:55 am on June 25, 2017: contributor

    This simplifies generateBlocks and further encapsulates the use of nNonce and nBits inside pow.o by introducing a new function MaybeGenerateProof.

    This should be helpful for any attempt to support a testnet with signed blocks (see #9177 )

  2. fanquake added the label Refactoring on Jun 25, 2017
  3. fanquake added the label Mining on Jun 25, 2017
  4. in src/pow.cpp:102 in f91c9df38b outdated
     97+    while (max_tries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(blockHash, pblock->nBits, params)) {
     98+        ++pblock->nNonce;
     99+        blockHash = pblock->GetHash();
    100+        --max_tries;
    101+    }
    102+    return CheckProofOfWork(blockHash, pblock->nBits, params);
    


    sipa commented at 7:41 pm on August 27, 2017:
    It seems unnecessary to call CheckProofOfWork twice. You can move it from the while loop into the body, and make it return true immediately when it succeeds.
  5. jtimon force-pushed on Aug 28, 2017
  6. jtimon commented at 11:15 pm on August 28, 2017: contributor
    Fixed @sipa ’s nit.
  7. jtimon force-pushed on Jan 9, 2018
  8. jtimon commented at 4:06 am on January 9, 2018: contributor
    Rebased for no reason.
  9. Pow: Introduce MaybeGenerateProof 2382bf75a0
  10. jtimon force-pushed on Jan 31, 2018
  11. MarcoFalke commented at 2:45 pm on May 18, 2018: member
    Closing for now due to inactivity. We can reopen, when there is more appetite.
  12. MarcoFalke closed this on May 18, 2018

  13. DrahtBot 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-11-21 09:12 UTC

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