FatalError in EngineHandlerEvent (#9800)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Miguel
2024-07-25 10:49:17 -03:00
committed by GitHub
parent 8eb7416ced
commit 6aea07105a
2 changed files with 12 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ use std::{
pin::Pin,
task::{Context, Poll},
};
use tracing::*;
/// The type that drives the chain forward.
///
@@ -121,6 +122,10 @@ where
// bubble up the event
return Poll::Ready(ChainEvent::Handler(ev));
}
HandlerEvent::FatalError => {
error!(target: "engine::tree", "Fatal error");
return Poll::Ready(ChainEvent::FatalError)
}
}
}
Poll::Pending => {
@@ -190,6 +195,8 @@ pub enum HandlerEvent<T> {
BackfillAction(BackfillAction),
/// Other event emitted by the handler
Event(T),
// Fatal error
FatalError,
}
/// Internal events issued by the [`ChainOrchestrator`].

View File

@@ -84,6 +84,7 @@ where
// bubble up the event
Poll::Ready(HandlerEvent::Event(ev))
}
HandlerEvent::FatalError => Poll::Ready(HandlerEvent::FatalError),
}
}
RequestHandlerEvent::Download(req) => {
@@ -186,7 +187,10 @@ where
}
fn poll(&mut self, cx: &mut Context<'_>) -> Poll<RequestHandlerEvent<Self::Event>> {
let Some(ev) = ready!(self.from_tree.poll_recv(cx)) else { return Poll::Pending };
let Some(ev) = ready!(self.from_tree.poll_recv(cx)) else {
return Poll::Ready(RequestHandlerEvent::HandlerEvent(HandlerEvent::FatalError))
};
let ev = match ev {
EngineApiEvent::BeaconConsensus(ev) => {
RequestHandlerEvent::HandlerEvent(HandlerEvent::Event(ev))