Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub const ETH1_CACHE_DB_KEY: [u8; 32] = [0; 32];
pub const FORK_CHOICE_DB_KEY: [u8; 32] = [0; 32];

/// The result of a chain segment processing.
#[derive(Debug)]
pub enum ChainSegmentResult<T: EthSpec> {
/// Processing this chain segment finished successfully.
Successful { imported_blocks: usize },
Expand Down Expand Up @@ -1310,7 +1309,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
debug!(
self.log,
"Rejected gossip block";
"error" => format!("{:?}", e),
"error" => e.to_string(),
"graffiti" => graffiti_string,
"slot" => slot,
);
Expand Down Expand Up @@ -1393,11 +1392,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
trace!(
self.log,
"Beacon block rejected";
"reason" => format!("{:?}", other),
"reason" => other.to_string(),
);

let _ = self.event_handler.register(EventKind::BeaconBlockRejected {
reason: format!("Invalid block: {:?}", other),
reason: format!("Invalid block: {}", other),
block: Box::new(block),
});

Expand Down
11 changes: 11 additions & 0 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ pub enum BlockError<T: EthSpec> {
BeaconChainError(BeaconChainError),
}

impl<T: EthSpec> std::fmt::Display for BlockError<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BlockError::ParentUnknown(block) => {
write!(f, "ParentUnknown(parent_root:{})", block.parent_root())
}
other => write!(f, "{:?}", other),
}
}
}

impl<T: EthSpec> From<BlockSignatureVerifierError> for BlockError<T> {
fn from(e: BlockSignatureVerifierError) -> Self {
match e {
Expand Down