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

Fix inconsistent ValidatorState after reorgs #1009

Closed kostyantyn closed 5 years ago

kostyantyn commented 5 years ago

Resolves https://github.com/dtr-org/unit-e/issues/972

It's the follow-up commit of https://github.com/dtr-org/unit-e/pull/937

In this commit we instead of caching the finalizer's phase in ValidatorState.m_phase, we compute it on demand in ValidatorState::Phase WalletExtension::GetFinalizerPhase. This resolves the issue of unsynchronization ValidatorState with FinalizerState::Validator during re-orgs.

Also, ValidatorState::Phase was extended to show more precisely in which phase the finalizer is. The full list is:

Signed-off-by: Kostiantyn Stepaniuk kostia@thirdhash.com

kostyantyn commented 5 years ago

Force-pushed as this PR had a conflict with a master, had to rebase.

cornelius commented 5 years ago

Concept ACK