mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +00:00
fix approval-voting force-approve (#5229)
This commit is contained in:
@@ -506,18 +506,6 @@ pub(crate) async fn handle_new_head(
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
if let Some(up_to) = force_approve {
|
||||
gum::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve");
|
||||
|
||||
let approved_hashes = crate::ops::force_approve(db, block_hash, up_to)
|
||||
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
|
||||
|
||||
// Notify chain-selection of all approved hashes.
|
||||
for hash in approved_hashes {
|
||||
ctx.send_message(ChainSelectionMessage::Approved(hash)).await;
|
||||
}
|
||||
}
|
||||
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?block_hash,
|
||||
@@ -538,6 +526,21 @@ pub(crate) async fn handle_new_head(
|
||||
)
|
||||
})
|
||||
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
|
||||
|
||||
// force-approve needs to load the current block entry as well as all
|
||||
// ancestors. this can only be done after writing the block entry above.
|
||||
if let Some(up_to) = force_approve {
|
||||
gum::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve");
|
||||
|
||||
let approved_hashes = crate::ops::force_approve(db, block_hash, up_to)
|
||||
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
|
||||
|
||||
// Notify chain-selection of all approved hashes.
|
||||
for hash in approved_hashes {
|
||||
ctx.send_message(ChainSelectionMessage::Approved(hash)).await;
|
||||
}
|
||||
}
|
||||
|
||||
approval_meta.push(BlockApprovalMeta {
|
||||
hash: block_hash,
|
||||
number: block_header.number,
|
||||
|
||||
Reference in New Issue
Block a user