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 Unverified = Header;
|
||||||
type Verified = Header;
|
type Verified = Header;
|
||||||
|
|
||||||
fn create(input: Self::Input, engine: &EthEngine, _check_seal: bool) -> Result<Self::Unverified, (Self::Input, Error)> {
|
fn create(input: Self::Input, engine: &EthEngine, check_seal: bool) -> Result<Self::Unverified, (Self::Input, Error)> {
|
||||||
match verify_header_params(&input, engine, true) {
|
match verify_header_params(&input, engine, true, check_seal) {
|
||||||
Ok(_) => Ok(input),
|
Ok(_) => Ok(input),
|
||||||
Err(err) => Err((input, err))
|
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
|
/// 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> {
|
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)?;
|
verify_block_integrity(block)?;
|
||||||
|
|
||||||
if check_seal {
|
if check_seal {
|
||||||
@ -69,7 +69,7 @@ pub fn verify_block_basic(block: &Unverified, engine: &EthEngine, check_seal: bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
for uncle in &block.uncles {
|
for uncle in &block.uncles {
|
||||||
verify_header_params(uncle, engine, false)?;
|
verify_header_params(uncle, engine, false, check_seal)?;
|
||||||
if check_seal {
|
if check_seal {
|
||||||
engine.verify_block_basic(uncle)?;
|
engine.verify_block_basic(uncle)?;
|
||||||
}
|
}
|
||||||
@ -261,12 +261,14 @@ pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check basic header parameters.
|
/// Check basic header parameters.
|
||||||
pub fn verify_header_params(header: &Header, engine: &EthEngine, is_full: bool) -> Result<(), Error> {
|
pub fn verify_header_params(header: &Header, engine: &EthEngine, is_full: bool, check_seal: bool) -> Result<(), Error> {
|
||||||
let expected_seal_fields = engine.seal_fields(header);
|
if check_seal {
|
||||||
if header.seal().len() != expected_seal_fields {
|
let expected_seal_fields = engine.seal_fields(header);
|
||||||
return Err(From::from(BlockError::InvalidSealArity(
|
if header.seal().len() != expected_seal_fields {
|
||||||
Mismatch { expected: expected_seal_fields, found: header.seal().len() }
|
return Err(From::from(BlockError::InvalidSealArity(
|
||||||
)));
|
Mismatch { expected: expected_seal_fields, found: header.seal().len() }
|
||||||
|
)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if header.number() >= From::from(BlockNumber::max_value()) {
|
if header.number() >= From::from(BlockNumber::max_value()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user