Blockchain gets stucked if no blocks are mined

1

Yesterday I decided to fork a project, just for fun and to learn more about it. So, I forked a project, I generated my own genesis block, changed timestamps, nounce, keys, reset the min chain work. Everything was fine. Compiled it for Windows and Linux, it worked perfectly. I set up a wallet on a Vultr server, the other one in my own PC, mined a few blocks and then I went to bed.

The Vultr walllet kept running, but mine didn't, I closed it.

When I woke up and opened the wallet, it was trying to download blocks. getblocktemplate basically says it is downloading blocks, but there are no blocks to download. It says "8 hours behind".

I'm not sure if this is supposed to happend.

In my ignorance I'm going to assume it is normal: how do I fix it without having to delete everything and making a new chain?

If it's not normal: What did I do wrong?

user3084964

Posted 2018-09-13T22:08:57.107

Reputation: 13

Answers

0

In my ignorance I'm going to assume it is normal: how do I fix it without having to delete everything and making a new chain?

You can just comment out or remove the check in getblocktemplate so it won't error there.

You should also be able to bypass this by setting your computer's clock to around the time of the most recent block before you start the software. Once it has started, you can bring your computer's clock back to real time and then mine a block.

Andrew Chow

Posted 2018-09-13T22:08:57.107

Reputation: 40 910

Thanks. Why does this happens? Does it has something to do with DEFAULT_MAX_TIP_AGE?user3084964 2018-09-14T01:35:51.787

It happens because bitcoind (and therefore everything based off of it), uses some metrics to determine whether it has a fuly synced blockchain. One of those is the age of the most recent block (aka the blockchain tip). If it is more than a few hours (2 hours IIRC), then it thinks it is out of sync and thus will not exit the InitialBlockDownload phase where somethings are locked down. getblocktemplate is coded to not mine when the blockchain isn't synced as if you could, you could inadvertently cause a fork.Andrew Chow 2018-09-14T04:33:06.853

Got it. Thank you Andrew. Flawless explanation.user3084964 2018-09-14T05:12:33.717