Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

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

Merged
merged 5 commits into from
Oct 7, 2021

Conversation

strophy
Copy link
Contributor

@strophy strophy commented Oct 6, 2021

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?

  • Tested with local network
  • Tested to ensure testnet config stop/start still works
  • Needs testing in CI still

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@strophy strophy added this to the v0.21.0 milestone Oct 6, 2021
src/listr/tasks/stopNodeTaskFactory.js Outdated Show resolved Hide resolved
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also rename the task “Adjust mock time” to something like “Mock Core node time”

src/listr/tasks/stopNodeTaskFactory.js Outdated Show resolved Hide resolved
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very elegant solution! Good job! 👍

@strophy strophy merged commit 4c2698d into v0.21-dev Oct 7, 2021
@strophy strophy deleted the fix-mocktime branch October 7, 2021 12:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants