Skip to content

Commit

Permalink
move reconcile to after block add
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Aug 1, 2023
1 parent 49ef4c3 commit 6a7db77
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,17 @@ where B: BlockchainBackend + 'static

let block_result = self.reconcile_block(source_peer.clone(), new_block).await;

{
if block_result.is_err() {
let mut write_lock = self.list_of_reconciling_blocks.write().await;
write_lock.remove(&block_hash);
}
let block = block_result?;
self.handle_block(block, Some(source_peer)).await?;

let add_result = self.handle_block(block, Some(source_peer)).await;
{
let mut write_lock = self.list_of_reconciling_blocks.write().await;
write_lock.remove(&block_hash);
}
add_result?;
Ok(())
}

Expand Down

0 comments on commit 6a7db77

Please sign in to comment.