mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
Fix revert for non finalized blocks (#1479)
* fix: temporal modification to make revert works for non finalized blocks * fix: print info when the number of blocks asked to revert is higher than the number of reversible blocks * fix: remove function get_db_path_for_subcommand and remove it from all subcommands * fix: revert only non finalized blocks * fix: improve printed information for revert command * fix: new wasm file * chore: remove unused parameter * fix: revert log logic * fix: subcommands should take sub_matches instead of matches * fix: removing confusing message
This commit is contained in:
@@ -898,9 +898,11 @@ impl<Block> client::backend::Backend<Block, Blake2Hasher> for Backend<Block> whe
|
||||
|
||||
fn revert(&self, n: NumberFor<Block>) -> Result<NumberFor<Block>, client::error::Error> {
|
||||
use client::blockchain::HeaderBackend;
|
||||
|
||||
let mut best = self.blockchain.info()?.best_number;
|
||||
// if the best is lower to n(less then 256), just use best number in case overflow
|
||||
let n = if best < n { best } else { n };
|
||||
let finalized = self.blockchain.info()?.finalized_number;
|
||||
let revertible = best - finalized;
|
||||
let n = if revertible < n { revertible } else { n };
|
||||
|
||||
for c in 0 .. n.as_() {
|
||||
if best == As::sa(0) {
|
||||
|
||||
Reference in New Issue
Block a user