Add setter configurable only for benchmarking or tests (#9668)

* Add setter configurable only fior benchmarking or tests

* Update primitives/runtime/src/traits.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
girazoki
2021-09-09 12:45:16 +02:00
committed by GitHub
parent 129c9ed09e
commit b9e968fb3f
@@ -1585,6 +1585,14 @@ pub trait BlockNumberProvider {
/// ```
/// .
fn current_block_number() -> Self::BlockNumber;
/// Utility function only to be used in benchmarking scenarios, to be implemented optionally,
/// else a noop.
///
/// It allows for setting the block number that will later be fetched
/// This is useful in case the block number provider is different than System
#[cfg(feature = "runtime-benchmarks")]
fn set_block_number(_block: Self::BlockNumber) {}
}
#[cfg(test)]