mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: extend consensus with fork choice state (#27)
* consensus fork choice * fork_choice -> fork_choice_state
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1450,7 +1450,9 @@ dependencies = [
|
||||
"async-trait",
|
||||
"auto_impl",
|
||||
"reth-primitives",
|
||||
"reth-rpc-types",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -8,6 +8,8 @@ readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
reth-primitives = { path = "../primitives" }
|
||||
reth-rpc-types = { path = "../net/rpc-types" }
|
||||
async-trait = "0.1.57"
|
||||
thiserror = "1.0.37"
|
||||
auto_impl = "1.0"
|
||||
auto_impl = "1.0"
|
||||
tokio = { version = "1.21.2", features = ["sync"] }
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
use async_trait::async_trait;
|
||||
use reth_primitives::Header;
|
||||
use reth_rpc_types::engine::ForkchoiceState;
|
||||
use thiserror::Error;
|
||||
use tokio::sync::watch::Receiver;
|
||||
|
||||
/// Consensus is a protocol that chooses canonical chain.
|
||||
/// We are checking validity of block header here.
|
||||
#[async_trait]
|
||||
pub trait Consensus {
|
||||
/// Get a receiver for the fork choice state
|
||||
fn fork_choice_state(&self) -> Receiver<ForkchoiceState>;
|
||||
|
||||
/// Validate if header is correct and follows consensus specification
|
||||
fn validate_header(&self, _header: &Header) -> Result<(), Error> {
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user