mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
lookahead collator: read allowed ancestry len from relay client (#1180)
* Read allowed ancestry len from active config * extract load_abridged_host_configuration --------- Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
@@ -20,8 +20,8 @@ use polkadot_primitives::{
|
||||
};
|
||||
|
||||
use cumulus_primitives_core::{
|
||||
relay_chain::{BlockId as RBlockId, OccupiedCoreAssumption},
|
||||
ParaId,
|
||||
relay_chain::{self, BlockId as RBlockId, OccupiedCoreAssumption},
|
||||
AbridgedHostConfiguration, ParaId,
|
||||
};
|
||||
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
|
||||
|
||||
@@ -412,3 +412,18 @@ pub fn relay_slot_and_timestamp(
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Reads abridged host configuration from the relay chain storage at the given relay parent.
|
||||
pub async fn load_abridged_host_configuration(
|
||||
relay_parent: PHash,
|
||||
relay_client: &impl RelayChainInterface,
|
||||
) -> Result<Option<AbridgedHostConfiguration>, RelayChainError> {
|
||||
relay_client
|
||||
.get_storage_by_key(relay_parent, relay_chain::well_known_keys::ACTIVE_CONFIG)
|
||||
.await?
|
||||
.map(|bytes| {
|
||||
AbridgedHostConfiguration::decode(&mut &bytes[..])
|
||||
.map_err(RelayChainError::DeserializationError)
|
||||
})
|
||||
.transpose()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user