From 69fcf64d6c4a8fa60d3d83303a92972f39a8e9b1 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 16 Dec 2020 08:14:42 +1000 Subject: [PATCH] Disable issue URLs for "duplicate hash" errors (#1517) In our README, we tell users to ignore these errors, so we should also disable the issue URL. Also include the hash in the error. (We don't want the span active for all messages, we just want the hash in the error.) --- zebrad/src/application.rs | 12 +++++++++--- zebrad/src/components/sync/downloads.rs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/zebrad/src/application.rs b/zebrad/src/application.rs index 9ddc5214..60ede1e9 100644 --- a/zebrad/src/application.rs +++ b/zebrad/src/application.rs @@ -161,9 +161,15 @@ impl Application for ZebradApp { .issue_filter(|kind| match kind { color_eyre::ErrorKind::NonRecoverable(_) => true, color_eyre::ErrorKind::Recoverable(error) => { - !error.is::() - && !error.is::() - && !error.to_string().contains("timed out") + // type checks should be faster than string conversions + if error.is::() + || error.is::() + { + return false; + } + + let error_str = error.to_string(); + !error_str.contains("timed out") && !error_str.contains("duplicate hash") } }); diff --git a/zebrad/src/components/sync/downloads.rs b/zebrad/src/components/sync/downloads.rs index ca59abd7..bc1e5b7d 100644 --- a/zebrad/src/components/sync/downloads.rs +++ b/zebrad/src/components/sync/downloads.rs @@ -113,7 +113,7 @@ where #[instrument(level = "debug", skip(self), fields(%hash))] pub async fn download_and_verify(&mut self, hash: block::Hash) -> Result<(), Report> { if self.cancel_handles.contains_key(&hash) { - return Err(eyre!("duplicate hash queued for download")); + return Err(eyre!("duplicate hash queued for download: {:?}", hash)); } // We construct the block requests sequentially, waiting for the peer