mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
State db random fixes (#802)
* state-db: typo fixes * use fmt::Result for 'fmt' * state-db: typo fixes * state-db: use the same pattern to pass the parameter * state-db: follow the same style
This commit is contained in:
@@ -420,7 +420,7 @@ impl<Block: BlockT> Backend<Block> {
|
|||||||
|
|
||||||
Ok(Backend {
|
Ok(Backend {
|
||||||
storage: Arc::new(storage_db),
|
storage: Arc::new(storage_db),
|
||||||
tries_change_storage: tries_change_storage,
|
tries_change_storage,
|
||||||
blockchain,
|
blockchain,
|
||||||
canonicalization_delay,
|
canonicalization_delay,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ impl<Block: BlockT> Copy for BlockId<Block> {}
|
|||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<Block: BlockT> fmt::Display for BlockId<Block> {
|
impl<Block: BlockT> fmt::Display for BlockId<Block> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}", self)
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
//!
|
//!
|
||||||
//! # Canonicalization.
|
//! # Canonicalization.
|
||||||
//! Canonicalization window tracks a tree of blocks identified by header hash. The in-memory
|
//! Canonicalization window tracks a tree of blocks identified by header hash. The in-memory
|
||||||
//! overlay allows to get any node that was was inserted in any any of the blocks within the window.
|
//! overlay allows to get any node that was inserted in any of the blocks within the window.
|
||||||
//! The tree is journaled to the backing database and rebuilt on startup.
|
//! The tree is journaled to the backing database and rebuilt on startup.
|
||||||
//! Canonicalization function select one root from the top of the tree and discards all other roots and
|
//! Canonicalization function selects one root from the top of the tree and discards all other roots and
|
||||||
//! their subtrees.
|
//! their subtrees.
|
||||||
//!
|
//!
|
||||||
//! # Pruning.
|
//! # Pruning.
|
||||||
@@ -83,7 +83,7 @@ pub enum Error<E: fmt::Debug> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<E: fmt::Debug> fmt::Debug for Error<E> {
|
impl<E: fmt::Debug> fmt::Debug for Error<E> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Error::Db(e) => e.fmt(f),
|
Error::Db(e) => e.fmt(f),
|
||||||
Error::Decoding => write!(f, "Error decoding slicable value"),
|
Error::Decoding => write!(f, "Error decoding slicable value"),
|
||||||
@@ -174,7 +174,7 @@ impl<BlockHash: Hash, Key: Hash> StateDbSync<BlockHash, Key> {
|
|||||||
Ok(StateDbSync {
|
Ok(StateDbSync {
|
||||||
mode,
|
mode,
|
||||||
non_canonical,
|
non_canonical,
|
||||||
pruning: pruning,
|
pruning,
|
||||||
pinned: Default::default(),
|
pinned: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
|
|||||||
trace!(target: "state-db", "Finished reading uncanonicalized journal, {} entries", total);
|
trace!(target: "state-db", "Finished reading uncanonicalized journal, {} entries", total);
|
||||||
}
|
}
|
||||||
Ok(NonCanonicalOverlay {
|
Ok(NonCanonicalOverlay {
|
||||||
last_canonicalized: last_canonicalized,
|
last_canonicalized,
|
||||||
levels,
|
levels,
|
||||||
parents,
|
parents,
|
||||||
last_canonicalized_overlay: Default::default(),
|
last_canonicalized_overlay: Default::default(),
|
||||||
@@ -212,8 +212,8 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
|
|||||||
commit.data.inserted = self.last_canonicalized_overlay.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
|
commit.data.inserted = self.last_canonicalized_overlay.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
|
||||||
commit.data.deleted = overlay.deleted;
|
commit.data.deleted = overlay.deleted;
|
||||||
} else {
|
} else {
|
||||||
// TODO: borrow checker won't allow us to split out mutable refernces
|
// TODO: borrow checker won't allow us to split out mutable references
|
||||||
// required for recursive processing. A more efficient implementaion
|
// required for recursive processing. A more efficient implementation
|
||||||
// that does not require converting to vector is possible
|
// that does not require converting to vector is possible
|
||||||
let mut vec: Vec<_> = self.levels.drain(..).collect();
|
let mut vec: Vec<_> = self.levels.drain(..).collect();
|
||||||
Self::discard(&mut vec, &mut self.parents, &mut discarded_journals, 0, &overlay.hash);
|
Self::discard(&mut vec, &mut self.parents, &mut discarded_journals, 0, &overlay.hash);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ impl<AccountId, AccountIndex> fmt::Display for Address<AccountId, AccountIndex>
|
|||||||
AccountId: Member,
|
AccountId: Member,
|
||||||
AccountIndex: Member,
|
AccountIndex: Member,
|
||||||
{
|
{
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}", self)
|
write!(f, "{:?}", self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user