Skip to content

Commit

Permalink
use current branch for is_block_confirmed
Browse files Browse the repository at this point in the history
although unlikely, it may report false positives otherwise

also, it's probably a bit more efficient
  • Loading branch information
ecioppettini committed Feb 8, 2021
1 parent f985ae4 commit fead9eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jormungandr/src/explorer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,13 @@ impl ExplorerDB {
}

pub async fn is_block_confirmed(&self, block_id: &HeaderHash) -> bool {
if let Some(block) = self.get_block(block_id).await {
let current_branch = self
.multiverse
.get_ref(&self.longest_chain_tip.get_block_id().await)
.await
.unwrap();

if let Some(block) = current_branch.state().blocks.lookup(&block_id) {
let confirmed_block_chain_length: ChainLength = self
.stable_store
.confirmed_block_chain_length
Expand Down

0 comments on commit fead9eb

Please sign in to comment.