dashevo / dashmate

DEPRECATED Distribution package for Dash Masternode installation
MIT License
11 stars 12 forks source link

fix: block database contains a block from the future #448

Closed strophy closed 3 years ago

strophy commented 3 years ago

Issue being fixed or feature implemented

Dashmate local networks were failing after running for a longer period of time and/or with very short block times (e.g. 10sec on a 4th gen. i7, or 20sec in CI). #430 is also possibly related, and restarting the host without stopping dashmate first may also trigger the bug according to some reports. Core logs generally showed something similar to this:

2021-09-29T14:04:08.498538400Z 2021-09-29T14:04:08Z : The block database contains a block which appears to be from the future. This may be due to your computer's date and time being set incorrectly. Only rebuild the block database if you are sure that your computer's date and time are correct.
2021-09-29T14:04:08.498542600Z Please restart with -reindex or -reindex-chainstate to recover.
2021-09-29T14:04:08.498615500Z 2021-09-29T14:04:08Z Aborted block database rebuild. Exiting.

What was done?

The mocktime feature would simulate 2.5 minute blocks to ensure quorum requests still worked normally. When stopping and then restarting the network, the mocktime would not be set when scanning the block database, causing an error. This PR stores the blocktime to config on shutdown for local networks, and applies the mocktime (if present) to the config file on startup.

How Has This Been Tested?

Breaking Changes

None

Checklist:

For repository code-owners and collaborators only