Use correct ExecutionContext for check_inherents (#9483)

Before we used the `other` context, while we are actually either in the
import or sync context.
This commit is contained in:
Bastian Köcher
2021-08-03 13:12:21 +02:00
committed by GitHub
parent 0240efde58
commit 3b471704d9
6 changed files with 25 additions and 12 deletions
@@ -18,7 +18,7 @@ async-trait = "0.1.42"
codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] }
futures = { version = "0.3.1", features = ["thread-pool"] }
log = "0.4.8"
sp-core = { path= "../../core", version = "4.0.0-dev"}
sp-core = { path = "../../core", version = "4.0.0-dev"}
sp-inherents = { version = "4.0.0-dev", path = "../../inherents" }
sp-state-machine = { version = "0.10.0-dev", path = "../../state-machine" }
futures-timer = "3.0.1"
@@ -75,6 +75,16 @@ pub enum BlockOrigin {
File,
}
impl From<BlockOrigin> for sp_core::ExecutionContext {
fn from(origin: BlockOrigin) -> Self {
if origin == BlockOrigin::NetworkInitialSync {
sp_core::ExecutionContext::Syncing
} else {
sp_core::ExecutionContext::Importing
}
}
}
/// Environment for a Consensus instance.
///
/// Creates proposer instance.