Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Dont error in finality_target_with_longest_chain
Signed-off-by: Andrei Sandu <[email protected]>
  • Loading branch information
sandreim committed Jan 19, 2022
commit c5289f03f3cae49418a3ab2ed8b45c295f6aa172
23 changes: 19 additions & 4 deletions node/service/src/relay_chain_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,25 @@ where
std::any::type_name::<Self>(),
)
.await;
let (subchain_number, subchain_head) = rx
.await
.map_err(Error::DetermineUndisputedChainCanceled)
.map_err(|e| ConsensusError::Other(Box::new(e)))?;

// Try to fetch response from `dispute-coordinator`. If an error occurs we just log it
// and return `target_hash` as maximal vote. It is safer to contain this error here
// and not push it up the stack to cause additional issues in GRANDPA/BABE.
let (subchain_number, subchain_head) =
match rx.await.map_err(Error::DetermineUndisputedChainCanceled) {
Ok((lag, subchain_head)) => (lag, subchain_head),
Err(e) => {
tracing::warn!(
target: LOG_TARGET,
"Call to `DetermineUndisputedChain` failed: {}",
e
);
// We need to return a sane finality target. But, we are unable to ensure we are not
// finalizing something that is being disputed or has been concluded as invalid. We will be
// conservative here and not vote for finality above the ancestor passed in.
return Ok(target_hash)
},
};

// The the total lag accounting for disputes.
let lag_disputes = initial_leaf_number.saturating_sub(subchain_number);
Expand Down