mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
Check in block authoring that we can author with current authoring version (#4201)
* Check in block authoring that we can author with current authoring version * Update client/consensus/pow/src/lib.rs Co-Authored-By: André Silva <andre.beat@gmail.com> * Fix compilation
This commit is contained in:
@@ -33,6 +33,9 @@ use codec::Decode;
|
||||
use sr_primitives::RuntimeString;
|
||||
pub use sr_primitives::create_runtime_str;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use sr_primitives::{traits::Block as BlockT, generic::BlockId};
|
||||
|
||||
/// The identity of a particular API interface that the runtime might provide.
|
||||
pub type ApiId = [u8; 8];
|
||||
|
||||
@@ -165,6 +168,27 @@ impl NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that can provide the runtime version at a given block and the native runtime version.
|
||||
#[cfg(feature = "std")]
|
||||
pub trait GetRuntimeVersion<Block: BlockT> {
|
||||
/// Returns the version of the native runtime.
|
||||
fn native_version(&self) -> &NativeVersion;
|
||||
|
||||
/// Returns the version of runtime at the given block.
|
||||
fn runtime_version(&self, at: &BlockId<Block>) -> Result<RuntimeVersion, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: GetRuntimeVersion<Block>, Block: BlockT> GetRuntimeVersion<Block> for std::sync::Arc<T> {
|
||||
fn native_version(&self) -> &NativeVersion {
|
||||
(&**self).native_version()
|
||||
}
|
||||
|
||||
fn runtime_version(&self, at: &BlockId<Block>) -> Result<RuntimeVersion, String> {
|
||||
(&**self).runtime_version(at)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
mod apis_serialize {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user