fix: mark downloaded block as invalid if insertion fails (#3003)

This commit is contained in:
Dan Cline
2023-06-05 20:13:54 -04:00
committed by GitHub
parent 088c388d13
commit 9614b4667c
2 changed files with 10 additions and 0 deletions

View File

@ -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);
}
}
}
}