Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit b074490

Browse files
committed
Merge branch 'master' into rh-translate-linked-map
2 parents 5e54223 + 7882745 commit b074490

File tree

39 files changed

+1101
-556
lines changed

39 files changed

+1101
-556
lines changed

Cargo.lock

Lines changed: 211 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ fn fill_network_configuration(
628628
wasm_external_transport: None,
629629
};
630630

631+
config.max_parallel_downloads = cli.max_parallel_downloads;
632+
631633
Ok(())
632634
}
633635

core/cli/src/params.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ pub struct NetworkConfigurationParams {
146146
pub port: Option<u16>,
147147

148148
/// Specify the number of outgoing connections we're trying to maintain.
149-
#[structopt(long = "out-peers", value_name = "OUT_PEERS", default_value = "25")]
149+
#[structopt(long = "out-peers", value_name = "COUNT", default_value = "25")]
150150
pub out_peers: u32,
151151

152152
/// Specify the maximum number of incoming connections we're accepting.
153-
#[structopt(long = "in-peers", value_name = "IN_PEERS", default_value = "25")]
153+
#[structopt(long = "in-peers", value_name = "COUNT", default_value = "25")]
154154
pub in_peers: u32,
155155

156156
/// Disable mDNS discovery.
@@ -160,6 +160,13 @@ pub struct NetworkConfigurationParams {
160160
#[structopt(long = "no-mdns")]
161161
pub no_mdns: bool,
162162

163+
/// Maximum number of peers to ask the same blocks in parallel.
164+
///
165+
/// This allows downlading announced blocks from multiple peers. Decrease to save
166+
/// traffic and risk increased latency.
167+
#[structopt(long = "max-parallel-downloads", value_name = "COUNT", default_value = "5")]
168+
pub max_parallel_downloads: u32,
169+
163170
#[allow(missing_docs)]
164171
#[structopt(flatten)]
165172
pub node_key_params: NodeKeyParams

core/client/db/src/storage_cache.rs

Lines changed: 6 additions & 6 deletions
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 {

core/client/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
497497
/// Get longest range within [first; last] that is possible to use in `key_changes`
498498
/// and `key_changes_proof` calls.
499499
/// Range could be shortened from the beginning if some changes tries have been pruned.
500-
/// Returns Ok(None) if changes trues are not supported.
500+
/// Returns Ok(None) if changes tries are not supported.
501501
pub fn max_key_changes_range(
502502
&self,
503503
first: NumberFor<Block>,

0 commit comments

Comments
 (0)