Add extra info to block proc. error message
This commit is contained in:
parent
f592183aa9
commit
c3779caede
@ -107,9 +107,14 @@ pub fn process_block_header(
|
|||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
verify!(block.slot == state.slot, Invalid::StateSlotMismatch);
|
verify!(block.slot == state.slot, Invalid::StateSlotMismatch);
|
||||||
|
|
||||||
|
let expected_previous_block_root =
|
||||||
|
Hash256::from_slice(&state.latest_block_header.signed_root());
|
||||||
verify!(
|
verify!(
|
||||||
block.previous_block_root == Hash256::from_slice(&state.latest_block_header.signed_root()),
|
block.previous_block_root == expected_previous_block_root,
|
||||||
Invalid::ParentBlockRootMismatch
|
Invalid::ParentBlockRootMismatch {
|
||||||
|
state: expected_previous_block_root,
|
||||||
|
block: block.previous_block_root,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
state.latest_block_header = block.temporary_block_header(spec);
|
state.latest_block_header = block.temporary_block_header(spec);
|
||||||
|
@ -67,7 +67,10 @@ impl_from_beacon_state_error!(BlockProcessingError);
|
|||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum BlockInvalid {
|
pub enum BlockInvalid {
|
||||||
StateSlotMismatch,
|
StateSlotMismatch,
|
||||||
ParentBlockRootMismatch,
|
ParentBlockRootMismatch {
|
||||||
|
state: Hash256,
|
||||||
|
block: Hash256,
|
||||||
|
},
|
||||||
BadSignature,
|
BadSignature,
|
||||||
BadRandaoSignature,
|
BadRandaoSignature,
|
||||||
MaxAttestationsExceeded,
|
MaxAttestationsExceeded,
|
||||||
|
Loading…
Reference in New Issue
Block a user