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

client: use appropriate ExecutionContext for initial sync / regular import #6180

Merged
merged 10 commits into from
Jun 12, 2020
Next Next commit
client: use appropriate ExecutionContext for sync/import
  • Loading branch information
andresilva committed May 28, 2020
commit d1bfd9086df2571a6998971288ca689c4a802bf7
13 changes: 10 additions & 3 deletions client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ use parking_lot::{Mutex, RwLock};
use codec::{Encode, Decode};
use hash_db::Prefix;
use sp_core::{
ChangesTrieConfiguration, convert_hash, NativeOrEncoded,
storage::{StorageKey, PrefixedStorageKey, StorageData, well_known_keys, ChildInfo},
convert_hash,
storage::{well_known_keys, ChildInfo, PrefixedStorageKey, StorageData, StorageKey},
ChangesTrieConfiguration, ExecutionContext, NativeOrEncoded,
};
use sc_telemetry::{telemetry, SUBSTRATE_INFO};
use sp_runtime::{
Expand Down Expand Up @@ -865,9 +866,15 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
// block.
(true, ref mut storage_changes @ None, Some(ref body)) => {
let runtime_api = self.runtime_api();
let execution_context = if import_block.origin == BlockOrigin::NetworkInitialSync {
andresilva marked this conversation as resolved.
Show resolved Hide resolved
ExecutionContext::Syncing
} else {
ExecutionContext::Importing
};

runtime_api.execute_block(
runtime_api.execute_block_with_context(
&at,
execution_context,
Block::new(import_block.header.clone(), body.clone()),
)?;

Expand Down