mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 15:07:59 +00:00
core/consensus,node/runtime: Declare and implement authorities endpoint (#3207)
The goal of the commit is to be able to retrieve the current set of authorities without needing to know the concrete consensus mechanism in place. In order to achieve the above this commit introduces the `core/consensus/common/primitives` crate, declaring the `ConsensusApi` runtime API. In addition it implements the above mentioned trait definition in `node/runtime` by returning the current authorities of the BABE consensus mechanism.
This commit is contained in:
committed by
DemiMarie-parity
parent
9388f48942
commit
cf80af9255
@@ -0,0 +1,31 @@
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Substrate is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Common consensus primitives.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use parity_codec::Codec;
|
||||
use client::decl_runtime_apis;
|
||||
use rstd::vec::Vec;
|
||||
|
||||
decl_runtime_apis! {
|
||||
/// Common consensus runtime api.
|
||||
pub trait ConsensusApi<AuthorityId: Codec> {
|
||||
/// Returns the set of authorities of the currently active consensus mechanism.
|
||||
fn authorities() -> Vec<AuthorityId>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user