dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Synchronize wallet import and chain reindexing #883

Closed dsaveliev closed 5 years ago

dsaveliev commented 5 years ago

Fixes #810 Depends on https://github.com/dtr-org/unit-e/pull/881

There is a race condition between import thread and wallets sync. It's possible for the wallet to process VOTE transaction meanwhile ThreadImport didn't import the corresponding validator yet. In order to avoid such problems during reindexing, I tried to sync these two processes.

In addition, I turned off validator state loading from backup since reindexing must restore it from scratch. This change depends on https://github.com/dtr-org/unit-e/pull/881, so the test will be red until the PR is merged.

Signed-off-by: Dmitry Saveliev dima@thirdhash.com

frolosofsky commented 5 years ago

The problem in the current test is that it relies (a bit) on finalization state which was restored from disk. We have finalization state serialization (see finalization::StateRepository::RestoreFromDisk) and I think it must not be called when fReindex. It would be great if we fix that right in this PR.

AM5800 commented 5 years ago

@dsaveliev I would appreciate a little bit less force-pushes and rebases. I briefly took a look yesterday evening and now this is very different, so I have to start from scratch.

AM5800 commented 5 years ago

Concept ACK Would like to see it in action with #881

scravy commented 5 years ago

Travis, twice:

feature_reindex_commits.py                     | ✖ Failed  | 18 s
dsaveliev commented 5 years ago

By design, waiting for https://github.com/dtr-org/unit-e/pull/881