mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 00:58:02 +00:00
Do not call longest chain by default (#6704)
* Do not call longest chain by default We always called longest chain by default just for some potential logging. This was probably some oversight for when this select chain implementation was introduced. * Fix tests
This commit is contained in:
@@ -203,19 +203,12 @@ where
|
||||
target_hash: Hash,
|
||||
maybe_max_number: Option<BlockNumber>,
|
||||
) -> Result<Hash, ConsensusError> {
|
||||
let longest_chain_best =
|
||||
self.longest_chain.finality_target(target_hash, maybe_max_number).await?;
|
||||
|
||||
if let IsDisputesAwareWithOverseer::Yes(ref selection) = self.selection {
|
||||
selection
|
||||
.finality_target_with_longest_chain(
|
||||
target_hash,
|
||||
longest_chain_best,
|
||||
maybe_max_number,
|
||||
)
|
||||
.finality_target_with_longest_chain(target_hash, maybe_max_number)
|
||||
.await
|
||||
} else {
|
||||
Ok(longest_chain_best)
|
||||
self.longest_chain.finality_target(target_hash, maybe_max_number).await
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,11 +357,9 @@ where
|
||||
pub(crate) async fn finality_target_with_longest_chain(
|
||||
&self,
|
||||
target_hash: Hash,
|
||||
best_leaf: Hash,
|
||||
maybe_max_number: Option<BlockNumber>,
|
||||
) -> Result<Hash, ConsensusError> {
|
||||
let mut overseer = self.overseer.clone();
|
||||
gum::trace!(target: LOG_TARGET, ?best_leaf, "Longest chain");
|
||||
|
||||
let subchain_head = {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
@@ -414,7 +405,7 @@ where
|
||||
let subchain_header = self.block_header(subchain_head)?;
|
||||
|
||||
if subchain_header.number <= max {
|
||||
gum::trace!(target: LOG_TARGET, ?best_leaf, "Constrained sub-chain head",);
|
||||
gum::trace!(target: LOG_TARGET, ?subchain_head, "Constrained sub-chain head",);
|
||||
subchain_head
|
||||
} else {
|
||||
let (ancestor_hash, _) =
|
||||
|
||||
@@ -88,7 +88,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
let target_hash = case_vars.target_block.clone();
|
||||
let selection_process = async move {
|
||||
let best = select_relay_chain
|
||||
.finality_target_with_longest_chain(target_hash, target_hash, None)
|
||||
.finality_target_with_longest_chain(target_hash, None)
|
||||
.await
|
||||
.unwrap();
|
||||
finality_target_tx.send(Some(best)).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user