Bitcoin Forum
May 27, 2024, 08:53:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Regtest: Can't mine blocks (anymore)  (Read 158 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1526
Merit: 7446


Farewell, Leo


View Profile
October 19, 2020, 11:23:48 AM
Last edit: October 19, 2020, 11:42:04 AM by BlackHatCoiner
 #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.


.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6761


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 20, 2020, 06: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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1526
Merit: 7446


Farewell, Leo


View Profile
October 20, 2020, 10: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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6761


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 20, 2020, 12:13:56 PM
 #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 <nblocks> <address> <maxtries>. 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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2422
Merit: 5644


Self-proclaimed Genius


View Profile
October 20, 2020, 12:19:47 PM
 #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?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1526
Merit: 7446


Farewell, Leo


View Profile
October 20, 2020, 12:32:33 PM
 #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 <nblocks> <address> <maxtries>. 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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2422
Merit: 5644


Self-proclaimed Genius


View Profile
October 20, 2020, 02:45:45 PM
Merited by BrewMaster (1)
 #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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!