mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 22:01:04 +00:00
Adds some derives for the inherent data stuff (#1543)
* Adds some derives for the inherent data stuff This makes working with them easier. * More defaults!
This commit is contained in:
@@ -50,6 +50,7 @@ pub use runtime_primitives::RuntimeString;
|
|||||||
pub type InherentIdentifier = [u8; 8];
|
pub type InherentIdentifier = [u8; 8];
|
||||||
|
|
||||||
/// Inherent data to include in a block.
|
/// Inherent data to include in a block.
|
||||||
|
#[derive(Clone, Default)]
|
||||||
pub struct InherentData {
|
pub struct InherentData {
|
||||||
/// All inherent data encoded with parity-codec and an identifier.
|
/// All inherent data encoded with parity-codec and an identifier.
|
||||||
data: BTreeMap<InherentIdentifier, Vec<u8>>
|
data: BTreeMap<InherentIdentifier, Vec<u8>>
|
||||||
@@ -152,7 +153,7 @@ impl codec::Decode for InherentData {
|
|||||||
///
|
///
|
||||||
/// When a fatal error occurres, all other errors are removed and the implementation needs to
|
/// When a fatal error occurres, all other errors are removed and the implementation needs to
|
||||||
/// abbort checking inherents.
|
/// abbort checking inherents.
|
||||||
#[derive(Encode, Decode)]
|
#[derive(Encode, Decode, Clone, Default)]
|
||||||
pub struct CheckInherentsResult {
|
pub struct CheckInherentsResult {
|
||||||
/// Did the check succeed?
|
/// Did the check succeed?
|
||||||
okay: bool,
|
okay: bool,
|
||||||
@@ -243,7 +244,7 @@ impl PartialEq for CheckInherentsResult {
|
|||||||
|
|
||||||
/// All `InherentData` providers.
|
/// All `InherentData` providers.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Default)]
|
||||||
pub struct InherentDataProviders {
|
pub struct InherentDataProviders {
|
||||||
providers: Arc<RwLock<Vec<Box<dyn ProvideInherentData + Send + Sync>>>>,
|
providers: Arc<RwLock<Vec<Box<dyn ProvideInherentData + Send + Sync>>>>,
|
||||||
}
|
}
|
||||||
@@ -252,9 +253,7 @@ pub struct InherentDataProviders {
|
|||||||
impl InherentDataProviders {
|
impl InherentDataProviders {
|
||||||
/// Create a new instance.
|
/// Create a new instance.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self::default()
|
||||||
providers: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register an `InherentData` provider.
|
/// Register an `InherentData` provider.
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ use runtime_primitives::ApplyResult;
|
|||||||
use runtime_primitives::transaction_validity::TransactionValidity;
|
use runtime_primitives::transaction_validity::TransactionValidity;
|
||||||
use runtime_primitives::generic;
|
use runtime_primitives::generic;
|
||||||
use runtime_primitives::traits::{
|
use runtime_primitives::traits::{
|
||||||
Convert, BlakeTwo256, Block as BlockT, DigestFor, NumberFor, Extrinsic, StaticLookup,
|
Convert, BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup,
|
||||||
};
|
};
|
||||||
use version::RuntimeVersion;
|
use version::RuntimeVersion;
|
||||||
use council::{motions as council_motions, voting as council_voting};
|
use council::{motions as council_motions, voting as council_voting};
|
||||||
|
|||||||
Reference in New Issue
Block a user