mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Use saturating_pow for max digest interval (#2506)
* Use saturating_pow for max digest interval * Impl version
This commit is contained in:
committed by
Bastian Köcher
parent
a63635b952
commit
9fc1db3280
@@ -53,16 +53,7 @@ impl ChangesTrieConfiguration {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// FIXME: use saturating_pow once stabilized - https://github.com/rust-lang/rust/issues/48320
|
||||
let mut max_digest_interval = self.digest_interval;
|
||||
for _ in 1..self.digest_levels {
|
||||
max_digest_interval = match max_digest_interval.checked_mul(self.digest_interval) {
|
||||
Some(max_digest_interval) => max_digest_interval,
|
||||
None => return u64::max_value(),
|
||||
}
|
||||
}
|
||||
|
||||
max_digest_interval
|
||||
self.digest_interval.saturating_pow(self.digest_levels)
|
||||
}
|
||||
|
||||
/// Returns Some if digest must be built at given block number.
|
||||
|
||||
Reference in New Issue
Block a user