Skip to content
Snippets Groups Projects
Commit 52912ab3 authored by asynchronous rob's avatar asynchronous rob Committed by GitHub
Browse files

fix approval-voting force-approve (#5229)

parent 5900c50c
No related merge requests found
......@@ -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,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment