mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: mark downloaded block as invalid if insertion fails (#3003)
This commit is contained in:
@ -1009,6 +1009,10 @@ where
|
||||
}
|
||||
Err(err) => {
|
||||
debug!(target: "consensus::engine", ?err, "Failed to insert downloaded block");
|
||||
if !matches!(err.kind(), InsertBlockErrorKind::Internal(_)) {
|
||||
// non-internal error kinds occurr if the payload is invalid
|
||||
self.invalid_headers.insert(err.into_block().header);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,12 @@ impl InsertBlockError {
|
||||
Self::new(block, InsertBlockErrorKind::Execution(error))
|
||||
}
|
||||
|
||||
/// Consumes the error and returns the block that resulted in the error
|
||||
#[inline]
|
||||
pub fn into_block(self) -> SealedBlock {
|
||||
self.inner.block
|
||||
}
|
||||
|
||||
/// Returns the error kind
|
||||
#[inline]
|
||||
pub fn kind(&self) -> &InsertBlockErrorKind {
|
||||
|
||||
Reference in New Issue
Block a user