mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Support custom fork choice rule (#1339)
* Support custom fork choice rule * Remove unneeded reexport * Fix network compile
This commit is contained in:
committed by
Robert Habermeier
parent
771a8127c2
commit
ac1be0665e
@@ -53,6 +53,15 @@ pub enum BlockOrigin {
|
||||
File,
|
||||
}
|
||||
|
||||
/// Fork choice strategy.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ForkChoiceStrategy {
|
||||
/// Longest chain fork choice.
|
||||
LongestChain,
|
||||
/// Custom fork choice rule, where true indicates the new block should be the best block.
|
||||
Custom(bool),
|
||||
}
|
||||
|
||||
/// Data required to import a Block
|
||||
pub struct ImportBlock<Block: BlockT> {
|
||||
/// Origin of the Block
|
||||
@@ -83,6 +92,8 @@ pub struct ImportBlock<Block: BlockT> {
|
||||
/// Contains a list of key-value pairs. If values are `None`, the keys
|
||||
/// will be deleted.
|
||||
pub auxiliary: Vec<(Vec<u8>, Option<Vec<u8>>)>,
|
||||
/// Fork choice strategy of this import.
|
||||
pub fork_choice: ForkChoiceStrategy,
|
||||
}
|
||||
|
||||
impl<Block: BlockT> ImportBlock<Block> {
|
||||
|
||||
@@ -55,7 +55,7 @@ pub mod evaluation;
|
||||
const MAX_TRANSACTIONS_SIZE: usize = 4 * 1024 * 1024;
|
||||
|
||||
pub use self::error::{Error, ErrorKind};
|
||||
pub use block_import::{BlockImport, ImportBlock, BlockOrigin, ImportResult};
|
||||
pub use block_import::{BlockImport, ImportBlock, BlockOrigin, ImportResult, ForkChoiceStrategy};
|
||||
|
||||
/// Trait for getting the authorities at a given block.
|
||||
pub trait Authorities<B: Block> {
|
||||
|
||||
Reference in New Issue
Block a user