mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-10-25 05:05:03 +00:00
More robust grandpa revert procedure (#11719)
* More robust revert procedure Return an error if revert is called in a node that is not actively running grandpa, i.e. grandpa genesis data has not been initialized. Previous implementation was just firing an `unreachable!` code exception. Furthermore we skip revert hassle if there is nothing to revert. * Nit
This commit is contained in:
1 parent
939c31bfde
commit
c189bd15de
2 files changed
+14
-2
No files matched your search
@@ -1873,7 +1873,11 @@ where
|
||||
{
|
||||
let best_number = client.info().best_number;
|
||||
let finalized = client.info().finalized_number;
|
||||
|
||||
let revertible = blocks.min(best_number - finalized);
|
||||
if revertible == Zero::zero() {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let revert_up_to_number = best_number - revertible;
|
||||
let revert_up_to_hash = client.hash(revert_up_to_number)?.ok_or(ClientError::Backend(
|
||||
|
||||
Reference in new issue
Block a user