Skip seal fields count check when --no-seal-check is used (#9757)
* Skip seal fields count check when --no-seal-check is used * Remove trailing whitespace
This commit is contained in:
parent
e9f4f1d13c
commit
ed34d1fee7
@ -209,8 +209,8 @@ pub mod headers {
|
||||
type Unverified = Header;
|
||||
type Verified = Header;
|
||||
|
||||
fn create(input: Self::Input, engine: &EthEngine, _check_seal: bool) -> Result<Self::Unverified, (Self::Input, Error)> {
|
||||
match verify_header_params(&input, engine, true) {
|
||||
fn create(input: Self::Input, engine: &EthEngine, check_seal: bool) -> Result<Self::Unverified, (Self::Input, Error)> {
|
||||
match verify_header_params(&input, engine, true, check_seal) {
|
||||
Ok(_) => Ok(input),
|
||||
Err(err) => Err((input, err))
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ impl HeapSizeOf for PreverifiedBlock {
|
||||
|
||||
/// Phase 1 quick block verification. Only does checks that are cheap. Operates on a single block
|
||||
pub fn verify_block_basic(block: &Unverified, engine: &EthEngine, check_seal: bool) -> Result<(), Error> {
|
||||
verify_header_params(&block.header, engine, true)?;
|
||||
verify_header_params(&block.header, engine, true, check_seal)?;
|
||||
verify_block_integrity(block)?;
|
||||
|
||||
if check_seal {
|
||||
@ -69,7 +69,7 @@ pub fn verify_block_basic(block: &Unverified, engine: &EthEngine, check_seal: bo
|
||||
}
|
||||
|
||||
for uncle in &block.uncles {
|
||||
verify_header_params(uncle, engine, false)?;
|
||||
verify_header_params(uncle, engine, false, check_seal)?;
|
||||
if check_seal {
|
||||
engine.verify_block_basic(uncle)?;
|
||||
}
|
||||
@ -261,12 +261,14 @@ pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error>
|
||||
}
|
||||
|
||||
/// Check basic header parameters.
|
||||
pub fn verify_header_params(header: &Header, engine: &EthEngine, is_full: bool) -> Result<(), Error> {
|
||||
let expected_seal_fields = engine.seal_fields(header);
|
||||
if header.seal().len() != expected_seal_fields {
|
||||
return Err(From::from(BlockError::InvalidSealArity(
|
||||
Mismatch { expected: expected_seal_fields, found: header.seal().len() }
|
||||
)));
|
||||
pub fn verify_header_params(header: &Header, engine: &EthEngine, is_full: bool, check_seal: bool) -> Result<(), Error> {
|
||||
if check_seal {
|
||||
let expected_seal_fields = engine.seal_fields(header);
|
||||
if header.seal().len() != expected_seal_fields {
|
||||
return Err(From::from(BlockError::InvalidSealArity(
|
||||
Mismatch { expected: expected_seal_fields, found: header.seal().len() }
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
if header.number() >= From::from(BlockNumber::max_value()) {
|
||||
|
Loading…
Reference in New Issue
Block a user