chore: add traces for _new_ invalid blocks (#3821)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Dan Cline
2023-07-18 09:55:08 -04:00
committed by GitHub
parent 26b1ffa92a
commit 20a06e840a

View File

@ -870,7 +870,7 @@ where
// check if the new head was previously invalidated, if so then we deem this FCU
// as invalid
if let Some(invalid_ancestor) = self.check_invalid_ancestor(state.head_block_hash) {
debug!(target: "consensus::engine", head=?state.head_block_hash, "Head was previously marked as invalid");
debug!(target: "consensus::engine", head=?state.head_block_hash, current_error=?error, "Head was previously marked as invalid");
return invalid_ancestor
}
@ -1170,6 +1170,8 @@ where
let (block, error) = err.split();
if error.is_invalid_block() {
warn!(target: "consensus::engine", invalid_hash=?block.hash, invalid_number=?block.number, ?error, "Invalid block error on new payload");
// all of these occurred if the payload is invalid
let parent_hash = block.parent_hash;
@ -1271,7 +1273,10 @@ where
Err(err) => {
warn!(target: "consensus::engine", ?err, "Failed to insert downloaded block");
if err.kind().is_invalid_block() {
self.invalid_headers.insert(err.into_block().header);
let (block, err) = err.split();
warn!(target: "consensus::engine", invalid_number=?block.number, invalid_hash=?block.hash, ?err, "Marking block as invalid");
self.invalid_headers.insert(block.header);
}
}
}
@ -1429,7 +1434,7 @@ where
}
if let ControlFlow::Unwind { bad_block, .. } = ctrl {
trace!(target: "consensus::engine", hash=?bad_block.hash, "Bad block detected in unwind");
warn!(target: "consensus::engine", invalid_hash=?bad_block.hash, invalid_number=?bad_block.number, "Bad block detected in unwind");
// update the `invalid_headers` cache with the new invalid headers
self.invalid_headers.insert(bad_block);