mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
sc-consensus-beefy: restart voter on pallet reset (#14821)
When detecting pallet-beefy consensus reset, just reinitialize the worker and continue without bringing down the task (and possibly the node). Signed-off-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -24,7 +24,7 @@ use std::collections::{HashMap, VecDeque};
|
||||
|
||||
/// Report specifying a reputation change for a given peer.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct PeerReport {
|
||||
pub struct PeerReport {
|
||||
pub who: PeerId,
|
||||
pub cost_benefit: ReputationChange,
|
||||
}
|
||||
|
||||
+5
-6
@@ -18,7 +18,7 @@
|
||||
|
||||
use codec::DecodeAll;
|
||||
use futures::{channel::oneshot, StreamExt};
|
||||
use log::{debug, error, trace};
|
||||
use log::{debug, trace};
|
||||
use sc_client_api::BlockBackend;
|
||||
use sc_network::{
|
||||
config as netconfig, config::RequestResponseConfig, types::ProtocolName, PeerId,
|
||||
@@ -182,7 +182,9 @@ where
|
||||
}
|
||||
|
||||
/// Run [`BeefyJustifsRequestHandler`].
|
||||
pub async fn run(mut self) {
|
||||
///
|
||||
/// Should never end, returns `Error` otherwise.
|
||||
pub async fn run(&mut self) -> Error {
|
||||
trace!(target: BEEFY_SYNC_LOG_TARGET, "🥩 Running BeefyJustifsRequestHandler");
|
||||
|
||||
while let Ok(request) = self
|
||||
@@ -215,9 +217,6 @@ where
|
||||
},
|
||||
}
|
||||
}
|
||||
error!(
|
||||
target: crate::LOG_TARGET,
|
||||
"🥩 On-demand requests receiver stream terminated, closing worker."
|
||||
);
|
||||
Error::RequestsReceiverStreamClosed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ pub struct JustificationRequest<B: Block> {
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub(crate) enum Error {
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Client(#[from] sp_blockchain::Error),
|
||||
|
||||
@@ -102,4 +102,7 @@ pub(crate) enum Error {
|
||||
|
||||
#[error("Internal error while getting response.")]
|
||||
ResponseError,
|
||||
|
||||
#[error("On-demand requests receiver stream terminated.")]
|
||||
RequestsReceiverStreamClosed,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user