Skip to content

Commit

Permalink
Rewrite top_key_values processing in process_state_verified()
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Oct 26, 2024
1 parent a3f9f8f commit f40e937
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions substrate/client/network/sync/src/strategy/state_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,12 @@ where
if entry.0.len() > 0 && entry.1.len() > 1 {
// Already imported child_trie with same root.
// Warning this will not work with parallel download.
} else if entry.0.is_empty() {
for (key, _value) in top_key_values.iter() {
self.imported_bytes += key.len() as u64;
}

entry.0 = top_key_values;
} else {
for (key, value) in top_key_values {
for (key, _value) in &top_key_values {
self.imported_bytes += key.len() as u64;
entry.0.push((key, value))
}

entry.0.extend(top_key_values);
}
}
}
Expand Down

0 comments on commit f40e937

Please sign in to comment.