Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions primitives/runtime/src/generic/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ use sp_std::prelude::*;

/// Something to identify a block.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub enum BlockId<Block: BlockT> {
/// Identify by block header hash.
Hash(Block::Hash),
Expand All @@ -45,12 +42,12 @@ pub enum BlockId<Block: BlockT> {

impl<Block: BlockT> BlockId<Block> {
/// Create a block ID from a hash.
pub fn hash(hash: Block::Hash) -> Self {
pub const fn hash(hash: Block::Hash) -> Self {
BlockId::Hash(hash)
}

/// Create a block ID from a number.
pub fn number(number: NumberFor<Block>) -> Self {
pub const fn number(number: NumberFor<Block>) -> Self {
BlockId::Number(number)
}

Expand Down