Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Derive Clone for AlwaysCanAuthor, NeverCanAuthor, CanAuthorWithNativeVersion #6906

Merged
merged 1 commit into from
Aug 17, 2020
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
3 changes: 3 additions & 0 deletions primitives/consensus/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ pub trait CanAuthorWith<Block: BlockT> {

/// Checks if the node can author blocks by using
/// [`NativeVersion::can_author_with`](sp_version::NativeVersion::can_author_with).
#[derive(Clone)]
pub struct CanAuthorWithNativeVersion<T>(T);

impl<T> CanAuthorWithNativeVersion<T> {
Expand Down Expand Up @@ -239,6 +240,7 @@ impl<T: sp_version::GetRuntimeVersion<Block>, Block: BlockT> CanAuthorWith<Block
}

/// Returns always `true` for `can_author_with`. This is useful for tests.
#[derive(Clone)]
pub struct AlwaysCanAuthor;

impl<Block: BlockT> CanAuthorWith<Block> for AlwaysCanAuthor {
Expand All @@ -248,6 +250,7 @@ impl<Block: BlockT> CanAuthorWith<Block> for AlwaysCanAuthor {
}

/// Never can author.
#[derive(Clone)]
pub struct NeverCanAuthor;

impl<Block: BlockT> CanAuthorWith<Block> for NeverCanAuthor {
Expand Down