Skip to content

Commit a6d8f6c

Browse files
committed
Merge remote-tracking branch 'paritytech/master' into refactor-authority-discovery
2 parents 0b8f7dd + 7882745 commit a6d8f6c

24 files changed

+829
-354
lines changed

Cargo.lock

+99-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/client/db/src/storage_cache.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,12 @@ impl<B: BlockT, H: Hasher> Cache<B, H> {
155155

156156
/// Synchronize the shared cache with the best block state.
157157
/// This function updates the shared cache by removing entries
158-
/// that are invalidated by chain reorganization. It should be
159-
/// be called when chain reorg happens without importing a new block.
158+
/// that are invalidated by chain reorganization. It should be called
159+
/// externally when chain reorg happens without importing a new block.
160160
pub fn sync(&mut self, enacted: &[B::Hash], retracted: &[B::Hash]) {
161161
trace!("Syncing shared cache, enacted = {:?}, retracted = {:?}", enacted, retracted);
162162

163163
// Purge changes from re-enacted and retracted blocks.
164-
// Filter out commiting block if any.
165164
let mut clear = false;
166165
for block in enacted {
167166
clear = clear || {
@@ -313,6 +312,7 @@ impl<H: Hasher, B: BlockT> CacheChanges<H, B> {
313312
let is_best = is_best();
314313
trace!("Syncing cache, id = (#{:?}, {:?}), parent={:?}, best={}", commit_number, commit_hash, self.parent_hash, is_best);
315314
let cache = &mut *cache;
315+
// Filter out commiting block if any.
316316
let enacted: Vec<_> = enacted
317317
.iter()
318318
.filter(|h| commit_hash.as_ref().map_or(true, |p| *h != p))
@@ -370,7 +370,7 @@ impl<H: Hasher, B: BlockT> CacheChanges<H, B> {
370370
modifications.insert(k);
371371
}
372372

373-
// Save modified storage. These are ordered by the block number.
373+
// Save modified storage. These are ordered by the block number in reverse.
374374
let block_changes = BlockChanges {
375375
storage: modifications,
376376
child_storage: child_modifications,
@@ -427,10 +427,10 @@ impl<H: Hasher, S: StateBackend<H>, B: BlockT> CachingState<H, S, B> {
427427
}
428428
Some(ref parent) => parent,
429429
};
430-
// Ignore all storage modified in later blocks
430+
// Ignore all storage entries modified in later blocks.
431431
// Modifications contains block ordered by the number
432432
// We search for our parent in that list first and then for
433-
// all its parent until we hit the canonical block,
433+
// all its parents until we hit the canonical block,
434434
// checking against all the intermediate modifications.
435435
for m in modifications {
436436
if &m.hash == parent {

0 commit comments

Comments
 (0)