mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
nightly fmt
This commit is contained in:
+2
-2
@@ -179,8 +179,8 @@ impl<T: Runtime> ClientBuilder<T> {
|
|||||||
rpc.system_properties(),
|
rpc.system_properties(),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
let metadata = metadata?;
|
let metadata = metadata?;
|
||||||
let mortal_period = Some(metadata.derive_mortal_period()?);
|
let mortal_period = Some(metadata.derive_mortal_period()?);
|
||||||
Ok(Client {
|
Ok(Client {
|
||||||
rpc,
|
rpc,
|
||||||
genesis_hash: genesis_hash?,
|
genesis_hash: genesis_hash?,
|
||||||
|
|||||||
+25
-25
@@ -173,33 +173,33 @@ impl Metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
string
|
string
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Derive a default mortal period
|
/// Derive a default mortal period
|
||||||
pub(crate) fn derive_mortal_period(&self) -> Result<u64, MetadataError> {
|
pub(crate) fn derive_mortal_period(&self) -> Result<u64, MetadataError> {
|
||||||
let block_hash_count = if let Ok(system_meta) = self.module("System") {
|
let block_hash_count = if let Ok(system_meta) = self.module("System") {
|
||||||
if let Ok(count) = system_meta.constant("BlockHashCount") {
|
if let Ok(count) = system_meta.constant("BlockHashCount") {
|
||||||
count.value::<u32>()?.into()
|
count.value::<u32>()?.into()
|
||||||
} else {
|
} else {
|
||||||
FALLBACK_BLOCK_HASH_COUNT
|
FALLBACK_BLOCK_HASH_COUNT
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FALLBACK_BLOCK_HASH_COUNT
|
FALLBACK_BLOCK_HASH_COUNT
|
||||||
};
|
};
|
||||||
let block_time = if let Ok(babe_meta) = self.module("Babe") {
|
let block_time = if let Ok(babe_meta) = self.module("Babe") {
|
||||||
if let Ok(milliseconds) = babe_meta.constant("ExpectedBlockTime") {
|
if let Ok(milliseconds) = babe_meta.constant("ExpectedBlockTime") {
|
||||||
milliseconds.value::<u64>()?
|
milliseconds.value::<u64>()?
|
||||||
} else {
|
} else {
|
||||||
FALLBACK_EXPECTED_BLOCK_TIME
|
FALLBACK_EXPECTED_BLOCK_TIME
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FALLBACK_EXPECTED_BLOCK_TIME
|
FALLBACK_EXPECTED_BLOCK_TIME
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((BASELINE_MORTAL_PERIOD / block_time)
|
Ok((BASELINE_MORTAL_PERIOD / block_time)
|
||||||
.next_power_of_two()
|
.next_power_of_two()
|
||||||
.min(block_hash_count.next_power_of_two()))
|
.min(block_hash_count.next_power_of_two()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|||||||
Reference in New Issue
Block a user