mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Revert non-best block (#11716)
* Revert non-best block This makes `revert` also revert non-best blocks. * Update client/db/src/lib.rs * Do not count leaves against the maximum number to revert * Add some explanation * Fix bug * Apply suggestions from code review Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Davide Galassi <davxy@datawok.net>
This commit is contained in:
@@ -507,7 +507,8 @@ pub trait Backend<Block: BlockT>: AuxStore + Send + Sync {
|
||||
|
||||
/// Attempts to revert the chain by `n` blocks. If `revert_finalized` is set it will attempt to
|
||||
/// revert past any finalized block, this is unsafe and can potentially leave the node in an
|
||||
/// inconsistent state.
|
||||
/// inconsistent state. All blocks higher than the best block are also reverted and not counting
|
||||
/// towards `n`.
|
||||
///
|
||||
/// Returns the number of blocks that were successfully reverted and the list of finalized
|
||||
/// blocks that has been reverted.
|
||||
|
||||
@@ -259,6 +259,11 @@ where
|
||||
|
||||
removed
|
||||
}
|
||||
|
||||
/// Returns the highest leaf and all hashes associated to it.
|
||||
pub fn highest_leaf(&self) -> Option<(N, &[H])> {
|
||||
self.storage.iter().next().map(|(k, v)| (k.0.clone(), &v[..]))
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper for undoing operations.
|
||||
|
||||
Reference in New Issue
Block a user