Extract Header-only methods of Consensus
to a separate trait
#12522
Labels
A-sdk
Related to reth's use as a library
C-enhancement
New feature or request
D-good-first-issue
Nice and easy! A great choice to get started
Describe the feature
With #12451
Consensus
is now generic over header and bodyreth/crates/consensus/consensus/src/lib.rs
Line 47 in e686fcc
However, in components which only know the header type we can't provide Consensus with Body generic, e.g
reth/crates/net/downloaders/src/headers/reverse_headers.rs
Line 70 in e686fcc
To address this, we'll need a separate trait which is alike
Consensus
but only operates on headers.Steps:
trait HeaderValidator<H = Header>
and moveConsensus
methods which only need header to it. Those includevalidate_header
,validate_header_against_parent
,validate_header_range
,validate_header_with_total_difficulty
Consensus<H = Header, B = Body>: HeaderValidator<H>
HeaderValidator
where neededAdditional context
No response
The text was updated successfully, but these errors were encountered: