Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::grandpa::Chain Struct Referenceabstract

#include <chain.hpp>

Inheritance diagram for kagome::consensus::grandpa::Chain:
Collaboration diagram for kagome::consensus::grandpa::Chain:

Public Member Functions

virtual ~Chain ()=default
 
virtual outcome::result< bool > hasBlock (const primitives::BlockHash &block) const =0
 Checks if {. More...
 
virtual outcome::result< std::vector< primitives::BlockHash > > getAncestry (const primitives::BlockHash &base, const primitives::BlockHash &block) const =0
 Get the ancestry of a {. More...
 
virtual bool hasAncestry (const primitives::BlockHash &base, const primitives::BlockHash &block) const =0
 Check if block is ancestor for second one. More...
 
virtual outcome::result< BlockInfobestChainContaining (const primitives::BlockHash &base, std::optional< VoterSetId > voter_set_id) const =0
 
bool isEqualOrDescendOf (const primitives::BlockHash &base, const primitives::BlockHash &block) const
 

Detailed Description

Chain context necessary for implementation of the finality gadget.

Definition at line 21 of file chain.hpp.

Constructor & Destructor Documentation

virtual kagome::consensus::grandpa::Chain::~Chain ( )
virtualdefault

Member Function Documentation

virtual outcome::result<BlockInfo> kagome::consensus::grandpa::Chain::bestChainContaining ( const primitives::BlockHash base,
std::optional< VoterSetId voter_set_id 
) const
pure virtual
Returns
the hash of the best block whose chain contains the given block hash, even if that block is {
Parameters
base}itself. If base is unknown, return None.

Implemented in kagome::consensus::grandpa::EnvironmentImpl.

virtual outcome::result<std::vector<primitives::BlockHash> > kagome::consensus::grandpa::Chain::getAncestry ( const primitives::BlockHash base,
const primitives::BlockHash block 
) const
pure virtual

Get the ancestry of a {.

Parameters
block}up to the {
base}hash. Should be in reverse order from block's parent.
Returns
If the block is not a descendant of base, returns an error.

Implemented in kagome::consensus::grandpa::EnvironmentImpl.

virtual bool kagome::consensus::grandpa::Chain::hasAncestry ( const primitives::BlockHash base,
const primitives::BlockHash block 
) const
pure virtual

Check if block is ancestor for second one.

Parameters
baseis potential ancestor
blockis testee block
Returns
true, if
Parameters
baseis ancestor for
block

Implemented in kagome::consensus::grandpa::EnvironmentImpl.

virtual outcome::result<bool> kagome::consensus::grandpa::Chain::hasBlock ( const primitives::BlockHash block) const
pure virtual

Checks if {.

Parameters
block}exists locally
Returns
true iff block exists

Implemented in kagome::consensus::grandpa::EnvironmentImpl.

bool kagome::consensus::grandpa::Chain::isEqualOrDescendOf ( const primitives::BlockHash base,
const primitives::BlockHash block 
) const
inline
Returns
true if {
Parameters
block}is a descendant of or equal to the given {
base}.

Definition at line 62 of file chain.hpp.


The documentation for this struct was generated from the following file: