Author

Topic: Regtest: Can't mine blocks (anymore) (Read 159 times)

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
October 20, 2020, 09:45:45 AM
#7
It may be another issue, since Regtest doesn't retarget.
Line 386: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L365-L386

Wait, is that for Bitcoin Core or the fork that you've mentioned before?
It does retarget if you change consensus.fPowNoRetargeting = true; to consensus.fPowNoRetargeting = false;
Ah, so you did compiled a modified version of Bitcoin core in this thread: Compiling error (chainparams.cpp: Permission denied)

Next time, please include any relevant info in the OP so people wouldn't think that you're using the default.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 20, 2020, 07:32:33 AM
#6
It may be another issue, since Regtest doesn't retarget.
Line 386: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L365-L386

Wait, is that for Bitcoin Core or the fork that you've mentioned before?

It does retarget if you change consensus.fPowNoRetargeting = true; to consensus.fPowNoRetargeting = false;

This is for bitcoin core, I didn't mentioned any forks before.

It's the third argument to the generatrtoaddress command: generatetoaddress
. It is an optional parameter and it's 1000000 by default.



I now get it. It stops mining after max tries. I set it to 100 million and it hasn't returned me any empty lists. I'm just waiting for my blocks to get mined.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
October 20, 2020, 07:19:47 AM
#5
It may be another issue, since Regtest doesn't retarget.
Line 386: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L365-L386

Wait, is that for Bitcoin Core or the fork that you've mentioned before?
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
October 20, 2020, 07:13:56 AM
#4
Maybe the difficulty became so high that generatetoaddress exceeded the maximum iterations?
Oh I see, if I generate 2016 blocks at once it makes difficulty too high, because of this:
Code:
difficulty = expected time / actual time

Since expected time is 20160 minutes then the equation would be that:
Code:
difficulty = 20160 / actual time

I generated 2016 blocks within 5-10 seconds so that makes difficulty ~= 2000, which is too big for just one computer.

On what script is that maxtries located?

It's the third argument to the generatrtoaddress command: generatetoaddress
. It is an optional parameter and it's 1000000 by default.


A few possibilities on what's causing this:
- Maybe it's not accepting the proof of work for any of the blocks your making and generateBlocks() returns an empty list.
- Or perhaps you exceeded the nonce, so that all block hashes are invalid so no blocks get added to generatetoaddress.
Why it may not accept the proof of work? Even if difficulty was too high, I would not get an empty list. The computer would just try to find a tiny target, which would fail. But it would lag the whole computer, it wouldn't return me an empty list.

Isn't the nonce just an integer? I don't get why is this relevant with my issue.

I don't think these points apply to this problem either now that you figured out the root cause is from the difficulty becoming too large.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 20, 2020, 05:35:38 AM
#3
Maybe the difficulty became so high that generatetoaddress exceeded the maximum iterations?
Oh I see, if I generate 2016 blocks at once it makes difficulty too high, because of this:
Code:
difficulty = expected time / actual time

Since expected time is 20160 minutes then the equation would be that:
Code:
difficulty = 20160 / actual time

I generated 2016 blocks within 5-10 seconds so that makes difficulty ~= 2000, which is too big for just one computer.

On what script is that maxtries located?

A few possibilities on what's causing this:
- Maybe it's not accepting the proof of work for any of the blocks your making and generateBlocks() returns an empty list.
- Or perhaps you exceeded the nonce, so that all block hashes are invalid so no blocks get added to generatetoaddress.
Why it may not accept the proof of work? Even if difficulty was too high, I would not get an empty list. The computer would just try to find a tiny target, which would fail. But it would lag the whole computer, it wouldn't return me an empty list.

Isn't the nonce just an integer? I don't get why is this relevant with my issue.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
October 20, 2020, 01:42:17 AM
#2
Maybe the difficulty became so high that generatetoaddress exceeded the maximum iterations? It takes a third argument maxtries that's the maximum number of times to try to find a block. It's 1000000 (1 million) by default. You can try increasing this value, but I wasn't able to reproduce your issue; I mined more than 2018 blocks on regtest, but it crashed before I reached 4000.

A few possibilities on what's causing this:
- Maybe it's not accepting the proof of work for any of the blocks your making and generateBlocks() returns an empty list.
- Or perhaps you exceeded the nonce, so that all block hashes are invalid so no blocks get added to generatetoaddress.

Can you reliably reproduce this problem?

Edit: It seems that it works fine if I generate 1 block per minute. It's not mining when I submit more than 1. Also I can't generatetoaddress 1 [address] too many times at once.

Looks like you didn't give the RPC call enough time to finish.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 19, 2020, 06:23:48 AM
#1


I've successfully mined 2018 blocks on my regtest mode, but it doesn't allow me mine anymore. Here's what I get when I try to:



Any ideas how can I continue mining?

Edit: It seems that it works fine if I generate 1 block per minute. It's not mining when I submit more than 1. Also I can't generatetoaddress 1 [address] too many times at once.

Jump to: