From fead9eb3a49c114eb951a9c54fa8b7d04372ede7 Mon Sep 17 00:00:00 2001 From: Enzo Cioppettini Date: Mon, 8 Feb 2021 10:47:31 -0300 Subject: [PATCH] use current branch for is_block_confirmed although unlikely, it may report false positives otherwise also, it's probably a bit more efficient --- jormungandr/src/explorer/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jormungandr/src/explorer/mod.rs b/jormungandr/src/explorer/mod.rs index de7c0868d5..62ee1c67b8 100644 --- a/jormungandr/src/explorer/mod.rs +++ b/jormungandr/src/explorer/mod.rs @@ -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