Remove internal miner #7507

pull Leviathn wants to merge 1 commits into bitcoin:master from Leviathn:master changing 7 files +0 −288
  1. Leviathn commented at 2:29 AM on February 11, 2016: none

    This code removes the internal miner which is only useful on Testnet. This leaves the internal miner that is useful on RegTest intact.

  2. Remove internal miner
    This code removes the internal miner which is only useful on Testnet.
    This leaves the internal miner that is useful on RegTest intact.
    8d1de43f0c
  3. TheBlueMatt commented at 2:29 AM on February 11, 2016: member

    ACK 8d1de43f0cbc79940d870d0ba09c7d28dd812ef8

  4. sipa commented at 2:32 AM on February 11, 2016: member

    Why? Having a builtin miner was tremendously useful when experimenting with segnet.

  5. dcousens commented at 2:32 AM on February 11, 2016: contributor

    ACK. But this was useful when testing Segnet.

    I guess this marks the official end of an era? Haha.

  6. TheBlueMatt commented at 2:38 AM on February 11, 2016: member

    @sipa Meh. Its really trivial to go git clone some CPU miner and point it to bitcoind...we dont need an entirely-unmaintained CPU miner in the codebase when we have a separate (?!) codepath for mining on regtest. If someone feels like merging this codepath and regtest, I'd be more happy, but having two separate built-in miners seems like overkill.

  7. sipa commented at 2:46 AM on February 11, 2016: member

    Feel free to go merge the codepaths then, or add a simple python based RPC miner instead. But I disagree with not being able to actually create valid blocks at all.

  8. wtogami commented at 2:48 AM on February 11, 2016: contributor

    https://github.com/pooler/cpuminer Much faster than the internal miner. Supports GBT.

  9. luke-jr commented at 2:50 AM on February 11, 2016: member

    BFGMiner also has CPU mining support FWIW.

  10. sipa commented at 2:53 AM on February 11, 2016: member

    Well at the very least, remove the restriction that generate can't be called on anything but regtest, and make it not stick in an infinite loop if no match is found after 2^32 attempts.

  11. sipa commented at 2:55 AM on February 11, 2016: member

    I agree with removing the duplicated code path, by the way. We wanted to do that when the regtest-specific behaviour of setgenerate was factored out into its own RPC, but we didn't want to make large changes at the time.

  12. pstratem commented at 3:03 AM on February 11, 2016: contributor

    Tested ACK

    8d1de43f0cbc79940d870d0ba09c7d28dd812ef8

  13. paveljanik commented at 6:47 AM on February 11, 2016: contributor
  14. paveljanik commented at 6:51 AM on February 11, 2016: contributor

    NITS: please remove some git grep BitcoinMiner occurrences:

    doc/developer-notes.md:- BitcoinMiner : Generates bitcoins (if wallet is enabled).
    src/miner.cpp:// BitcoinMiner
    

    Few more lines to be deleted...

  15. laanwj commented at 7:50 AM on February 11, 2016: member

    I tend to agree with this on the longer term.

    However, before this can be merged, there needs to be an easy to compile and set up CPU miner (let's say a "reference miner"). As well as instructions in doc/ for setting this up instead (as migration path for people using the internal miner).

    Last time this was proposed, that was far from the case. I tried various project that were proposed to be as alternative but they were professional miner tools with lots of setup options, or a tangled web of dependencies.

    So that's the condition.

  16. laanwj added the label Mining on Feb 11, 2016
  17. gmaxwell commented at 8:02 AM on February 11, 2016: contributor

    I argued pretty vigorously against this before in that I feel that Bitcoin Core should be "complete"-- that sending people off to weave together many programs to build a functioning system was not in the sincere spirit of decentralization. Today testnet is not really cpu minable and we have the regtest miner. So I'm increasingly feeling this is a principled distinction with no practical impact.

    I think Wladimir's call for an easy to setup cpu miner and clear docs is good; and perhaps the best remediation possible given the facts we can't control.

  18. luke-jr commented at 8:11 AM on February 11, 2016: member
    ./configure --enable-cpumining
    make
    ./bfgminer
    
  19. laanwj commented at 9:06 AM on February 11, 2016: member

    @luke-jr As a reference miner, that's like swatting a fly with a thermonuclear missile. Checking it out is like downloading an operating system. I'd prefer something minimal and self-contained that people can more easily study.

  20. sipa commented at 2:42 PM on February 11, 2016: member

    So if you would:

    • Keep deleting all code that this PR currently deletes
    • Remove the restriction that the generate RPC only works for regtest
    • Fix the bug that generate will go into an infinite loop when it needs to check more than 2^32 hashes, or even better add a timeout and allow it to fail.

    That means that instead of bitcoin-cli setgenerate true, you could use while true; do bitcoin-cli generate 1; done, with nearly no loss of functionality.

  21. pstratem commented at 11:25 PM on February 11, 2016: contributor

    @sipa that seems reasonable, but changing the behavior of the generate rpc probably belongs in a new pr

  22. laanwj commented at 12:14 PM on February 12, 2016: member

    I'm not sure about @sipa's solution. It is elegant because it removes duplicated code, but on the other hand I dislike a RPC call that can hang for a long time. This holds up a (precious) RPC thread instead of a dedicated mining thread. With a timeout (or "max iter count") it would certainly be acceptable to me though.

    But as you would effectively still need an external script to mine testnet, to keep calling generate after every timeout, instead of just pass -gen=1 and forget. I'm not convinced that this is better than a completely external reference miner. Easier to implement, sure.

    Edit: I've talked with @sipa on IRC and he convinced me that this is the way to go. Our 'reference miner' (for testnet) will just be a python script that calls generate in a loop.

  23. laanwj commented at 8:11 PM on March 6, 2016: member

    @Leviathn are you going to move this forward according to sipa's comment?

  24. sipa commented at 9:32 PM on March 9, 2016: member

    See #7663.

  25. laanwj merged this on Mar 14, 2016
  26. laanwj closed this on Mar 14, 2016

  27. laanwj referenced this in commit 11c769966a on Mar 14, 2016
  28. codablock referenced this in commit ec5bb7589c on Sep 16, 2017
  29. codablock referenced this in commit 4dbb136be0 on Sep 19, 2017
  30. codablock referenced this in commit 2b451ac162 on Dec 9, 2017
  31. codablock referenced this in commit fa03411150 on Dec 19, 2017
  32. Krekeler referenced this in commit 41795929e6 on Dec 16, 2018
  33. Krekeler referenced this in commit e82347d8ec on Dec 16, 2018
  34. PastaPastaPasta referenced this in commit f6f1737984 on Dec 31, 2019
  35. Krekeler referenced this in commit 3e284a42db on Feb 18, 2021
  36. 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: 2026-04-13 21:15 UTC

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