From 0b76352468d919ac392c11f59c1fa2b5844469a1 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 10 Feb 2021 09:05:14 +1000 Subject: [PATCH] Document a state_contains bug (#1715) * Document a state_contains bug in the syncer and Inbound --- zebrad/src/components/inbound/downloads.rs | 2 ++ zebrad/src/components/sync.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/zebrad/src/components/inbound/downloads.rs b/zebrad/src/components/inbound/downloads.rs index 97192d28b64..0d58727e2da 100644 --- a/zebrad/src/components/inbound/downloads.rs +++ b/zebrad/src/components/inbound/downloads.rs @@ -172,6 +172,8 @@ where let fut = async move { // Check if the block is already in the state. + // BUG: check if the hash is in any chain (#862). + // Depth only checks the main chain. match state.oneshot(zs::Request::Depth(hash)).await { Ok(zs::Response::Depth(None)) => Ok(()), Ok(zs::Response::Depth(Some(_))) => Err("already present".into()), diff --git a/zebrad/src/components/sync.rs b/zebrad/src/components/sync.rs index d673c6a2253..965bc6439ba 100644 --- a/zebrad/src/components/sync.rs +++ b/zebrad/src/components/sync.rs @@ -620,7 +620,8 @@ where /// Returns `true` if the hash is present in the state, and `false` /// if the hash is not present in the state. /// - /// TODO: handle multiple tips in the state. + /// BUG: check if the hash is in any chain (#862) + /// Depth only checks the main chain. async fn state_contains(&mut self, hash: block::Hash) -> Result { match self .state