mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
Companion for Substrate#9867 (#3938)
* Companion for Substrate#9867 * Fix finality_target_with_fallback() * update substrate Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Generated
+161
-161
File diff suppressed because it is too large
Load Diff
@@ -173,7 +173,7 @@ where
|
||||
&self,
|
||||
target_hash: Hash,
|
||||
maybe_max_number: Option<BlockNumber>,
|
||||
) -> Result<Option<Hash>, ConsensusError> {
|
||||
) -> Result<Hash, ConsensusError> {
|
||||
let longest_chain_best =
|
||||
self.longest_chain.finality_target(target_hash, maybe_max_number).await?;
|
||||
|
||||
@@ -316,9 +316,9 @@ where
|
||||
pub(crate) async fn finality_target_with_longest_chain(
|
||||
&self,
|
||||
target_hash: Hash,
|
||||
best_leaf: Option<Hash>,
|
||||
best_leaf: Hash,
|
||||
maybe_max_number: Option<BlockNumber>,
|
||||
) -> Result<Option<Hash>, ConsensusError> {
|
||||
) -> Result<Hash, ConsensusError> {
|
||||
let mut overseer = self.overseer.clone();
|
||||
|
||||
let subchain_head = if cfg!(feature = "disputes") {
|
||||
@@ -337,13 +337,14 @@ where
|
||||
|
||||
match best {
|
||||
// No viable leaves containing the block.
|
||||
None => return Ok(Some(target_hash)),
|
||||
None => return Ok(target_hash),
|
||||
Some(best) => best,
|
||||
}
|
||||
} else {
|
||||
match best_leaf {
|
||||
None => return Ok(Some(target_hash)),
|
||||
Some(best_leaf) => best_leaf,
|
||||
if best_leaf == target_hash {
|
||||
return Ok(target_hash)
|
||||
} else {
|
||||
best_leaf
|
||||
}
|
||||
};
|
||||
|
||||
@@ -362,7 +363,7 @@ where
|
||||
"`finality_target` max number is less than target number",
|
||||
);
|
||||
}
|
||||
return Ok(Some(target_hash))
|
||||
return Ok(target_hash)
|
||||
}
|
||||
// find the current number.
|
||||
let subchain_header = self.block_header(subchain_head)?;
|
||||
@@ -423,7 +424,7 @@ where
|
||||
subchain_number,
|
||||
"Mismatch of anticipated block descriptions and block number difference.",
|
||||
);
|
||||
return Ok(Some(target_hash))
|
||||
return Ok(target_hash)
|
||||
}
|
||||
// 3. Constrain according to disputes:
|
||||
let (tx, rx) = oneshot::channel();
|
||||
@@ -458,7 +459,7 @@ where
|
||||
|
||||
if safe_target <= target_number {
|
||||
// Minimal vote needs to be on the target number.
|
||||
Ok(Some(target_hash))
|
||||
Ok(target_hash)
|
||||
} else {
|
||||
// Otherwise we're looking for a descendant.
|
||||
let initial_leaf_header = self.block_header(initial_leaf)?;
|
||||
@@ -469,10 +470,10 @@ where
|
||||
)
|
||||
.map_err(|e| ConsensusError::ChainLookup(format!("{:?}", e)))?;
|
||||
|
||||
Ok(Some(forced_target))
|
||||
Ok(forced_target)
|
||||
}
|
||||
} else {
|
||||
Ok(Some(subchain_head))
|
||||
Ok(subchain_head)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user