This code removes the internal miner which is only useful on Testnet. This leaves the internal miner that is useful on RegTest intact.
Remove internal miner #7507
pull Leviathn wants to merge 1 commits into bitcoin:master from Leviathn:master changing 7 files +0 −288-
Leviathn commented at 2:29 AM on February 11, 2016: none
-
8d1de43f0c
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.
-
TheBlueMatt commented at 2:29 AM on February 11, 2016: member
ACK 8d1de43f0cbc79940d870d0ba09c7d28dd812ef8
-
sipa commented at 2:32 AM on February 11, 2016: member
Why? Having a builtin miner was tremendously useful when experimenting with segnet.
-
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.
-
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.
-
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.
-
wtogami commented at 2:48 AM on February 11, 2016: contributor
https://github.com/pooler/cpuminer Much faster than the internal miner. Supports GBT.
-
luke-jr commented at 2:50 AM on February 11, 2016: member
BFGMiner also has CPU mining support FWIW.
-
sipa commented at 2:53 AM on February 11, 2016: member
Well at the very least, remove the restriction that
generatecan'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. -
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
setgeneratewas factored out into its own RPC, but we didn't want to make large changes at the time. -
pstratem commented at 3:03 AM on February 11, 2016: contributor
Tested ACK
8d1de43f0cbc79940d870d0ba09c7d28dd812ef8
-
paveljanik commented at 6:47 AM on February 11, 2016: contributor
ACK https://github.com/Leviathn/bitcoin/commit/8d1de43f0cbc79940d870d0ba09c7d28dd812ef8 Great diffstat statistics, BTW ;-)
-
paveljanik commented at 6:51 AM on February 11, 2016: contributor
NITS: please remove some
git grep BitcoinMineroccurrences:doc/developer-notes.md:- BitcoinMiner : Generates bitcoins (if wallet is enabled). src/miner.cpp:// BitcoinMinerFew more lines to be deleted...
-
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.
- laanwj added the label Mining on Feb 11, 2016
-
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.
-
luke-jr commented at 8:11 AM on February 11, 2016: member
./configure --enable-cpumining make ./bfgminer -
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
generateRPC only works for regtest - Fix the bug that
generatewill 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 usewhile true; do bitcoin-cli generate 1; done, with nearly no loss of functionality. -
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 callinggenerateafter every timeout, instead of justpass -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
generatein a loop. - laanwj merged this on Mar 14, 2016
- laanwj closed this on Mar 14, 2016
- laanwj referenced this in commit 11c769966a on Mar 14, 2016
- codablock referenced this in commit ec5bb7589c on Sep 16, 2017
- codablock referenced this in commit 4dbb136be0 on Sep 19, 2017
- codablock referenced this in commit 2b451ac162 on Dec 9, 2017
- codablock referenced this in commit fa03411150 on Dec 19, 2017
- Krekeler referenced this in commit 41795929e6 on Dec 16, 2018
- Krekeler referenced this in commit e82347d8ec on Dec 16, 2018
- PastaPastaPasta referenced this in commit f6f1737984 on Dec 31, 2019
- Krekeler referenced this in commit 3e284a42db on Feb 18, 2021
- MarcoFalke locked this on Sep 8, 2021