From f97a20ccae309c1abfbd86f270440aa531a3f2bd Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Nov 2022 09:13:27 +1000 Subject: [PATCH 1/3] Fix error text for state service for syncer --- zebra-state/src/service.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index ac2ff5e1f20..1823da42d5f 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -609,14 +609,14 @@ impl StateService { .contains(&prepared.hash) { let (rsp_tx, rsp_rx) = oneshot::channel(); - let _ = rsp_tx.send(Err("block already sent to be committed to the state".into())); + let _ = rsp_tx.send(Err("block has already been sent to be committed to the state".into())); return rsp_rx; } if self.read_service.db.contains_height(prepared.height) { let (rsp_tx, rsp_rx) = oneshot::channel(); let _ = rsp_tx.send(Err( - "block height is already committed to the finalized state".into(), + "block height is in the finalized state: block is already committed to the state".into(), )); return rsp_rx; } From a06678c536ec4b402d8dee82a2d3ccb31c6adb14 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Nov 2022 09:15:16 +1000 Subject: [PATCH 2/3] Fix error handling in syncer --- zebrad/src/components/sync.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zebrad/src/components/sync.rs b/zebrad/src/components/sync.rs index 03179a1df84..b20218655f1 100644 --- a/zebrad/src/components/sync.rs +++ b/zebrad/src/components/sync.rs @@ -1120,9 +1120,10 @@ where BlockDownloadVerifyError::Invalid { error: VerifyChainError::Block(VerifyBlockError::Commit(ref source)), .. - } if format!("{source:?}").contains("block is already committed to the state") => { + } if format!("{source:?}").contains("block is already committed to the state") || + format!("{source:?}").contains("block has already been sent to be committed to the state") => { // TODO: improve this by checking the type (#2908) - debug!(error = ?e, "block is already committed, possibly from a previous sync run, continuing"); + debug!(error = ?e, "block is already committed or pending a commit, possibly from a previous sync run, continuing"); false } BlockDownloadVerifyError::DownloadFailed { ref error, .. } @@ -1152,6 +1153,7 @@ where if err_str.contains("AlreadyVerified") || err_str.contains("AlreadyInChain") || err_str.contains("block is already committed to the state") + || err_str.contains("block has already been sent to be committed to the state") || err_str.contains("NotFound") { error!(?e, From c31f0865af232053e48873d888c22eeec4cfb759 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 3 Nov 2022 11:47:48 +1000 Subject: [PATCH 3/3] cargo fmt --all --- zebra-state/src/service.rs | 7 +++++-- zebrad/src/components/sync.rs | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index 1823da42d5f..1b457f24a76 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -609,14 +609,17 @@ impl StateService { .contains(&prepared.hash) { let (rsp_tx, rsp_rx) = oneshot::channel(); - let _ = rsp_tx.send(Err("block has already been sent to be committed to the state".into())); + let _ = rsp_tx.send(Err( + "block has already been sent to be committed to the state".into(), + )); return rsp_rx; } if self.read_service.db.contains_height(prepared.height) { let (rsp_tx, rsp_rx) = oneshot::channel(); let _ = rsp_tx.send(Err( - "block height is in the finalized state: block is already committed to the state".into(), + "block height is in the finalized state: block is already committed to the state" + .into(), )); return rsp_rx; } diff --git a/zebrad/src/components/sync.rs b/zebrad/src/components/sync.rs index b20218655f1..fa1205dae00 100644 --- a/zebrad/src/components/sync.rs +++ b/zebrad/src/components/sync.rs @@ -1120,8 +1120,10 @@ where BlockDownloadVerifyError::Invalid { error: VerifyChainError::Block(VerifyBlockError::Commit(ref source)), .. - } if format!("{source:?}").contains("block is already committed to the state") || - format!("{source:?}").contains("block has already been sent to be committed to the state") => { + } if format!("{source:?}").contains("block is already committed to the state") + || format!("{source:?}") + .contains("block has already been sent to be committed to the state") => + { // TODO: improve this by checking the type (#2908) debug!(error = ?e, "block is already committed or pending a commit, possibly from a previous sync run, continuing"); false