Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
grandpa: log errors and grandpa unexpected conclusion (#6867)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva authored Aug 10, 2020
1 parent 5f9e355 commit 38a974c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions client/finality-grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use futures::{
prelude::*,
StreamExt,
};
use log::{debug, info};
use log::{debug, error, info};
use sc_client_api::{
backend::{AuxStore, Backend},
LockImportRun, BlockchainEvents, CallExecutor,
Expand Down Expand Up @@ -787,8 +787,12 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR>(
justification_sender,
);

let voter_work = voter_work
.map(|_| ());
let voter_work = voter_work.map(|res| match res {
Ok(()) => error!(target: "afg",
"GRANDPA voter future has concluded naturally, this should be unreachable."
),
Err(e) => error!(target: "afg", "GRANDPA voter error: {:?}", e),
});

// Make sure that `telemetry_task` doesn't accidentally finish and kill grandpa.
let telemetry_task = telemetry_task
Expand Down Expand Up @@ -1052,7 +1056,9 @@ where
Poll::Pending => {}
Poll::Ready(Ok(())) => {
// voters don't conclude naturally
return Poll::Ready(Err(Error::Safety("GRANDPA voter has concluded.".into())))
return Poll::Ready(
Err(Error::Safety("finality-grandpa inner voter has concluded.".into()))
)
}
Poll::Ready(Err(CommandOrError::Error(e))) => {
// return inner observer error
Expand All @@ -1069,7 +1075,9 @@ where
Poll::Pending => {}
Poll::Ready(None) => {
// the `voter_commands_rx` stream should never conclude since it's never closed.
return Poll::Ready(Ok(()))
return Poll::Ready(
Err(Error::Safety("`voter_commands_rx` was closed.".into()))
)
}
Poll::Ready(Some(command)) => {
// some command issued externally
Expand Down

0 comments on commit 38a974c

Please sign in to comment.