mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 21:31:02 +00:00
Refactory of Fork-Tree data structure (#11228)
* Iterative version of some fork-tree methods * Prune doesn't require its generic args to be 'clone' * Fork-tree import and drain-filter iterative implementations * Fork-tree map iterative implementation * Optimization of some operations, e.g. rebalance only when required * Destructuring assignments not supported yet by stable rustc 1.57 * Safe implementation of 'map' and 'drain_filter' methods * Remove dummy comment * Trigger CI pipeline * Test map for multi-root fork-tree and refactory of `find_node_index_where` * Fix find node index with predicate * Nits * Tree traversal algorithm is not specified * Move unspecified tree traversal warning to 'map' * Immutable 'drain_filter' predicate * Apply suggestions from code review * Remove double mapping Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -229,7 +229,7 @@ where
|
|||||||
where
|
where
|
||||||
F: Fn(&H, &H) -> Result<bool, E>,
|
F: Fn(&H, &H) -> Result<bool, E>,
|
||||||
{
|
{
|
||||||
let mut filter = |node_hash: &H, node_num: &N, _: &PendingChange<H, N>| {
|
let filter = |node_hash: &H, node_num: &N, _: &PendingChange<H, N>| {
|
||||||
if number >= *node_num &&
|
if number >= *node_num &&
|
||||||
(is_descendent_of(node_hash, &hash).unwrap_or_default() || *node_hash == hash)
|
(is_descendent_of(node_hash, &hash).unwrap_or_default() || *node_hash == hash)
|
||||||
{
|
{
|
||||||
@@ -245,7 +245,7 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Remove standard changes.
|
// Remove standard changes.
|
||||||
let _ = self.pending_standard_changes.drain_filter(&mut filter);
|
let _ = self.pending_standard_changes.drain_filter(&filter);
|
||||||
|
|
||||||
// Remove forced changes.
|
// Remove forced changes.
|
||||||
self.pending_forced_changes
|
self.pending_forced_changes
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user