From e8ea331203857a617b1934b1de166c5deb61b023 Mon Sep 17 00:00:00 2001 From: James Prestwich Date: Mon, 19 Jul 2021 15:06:06 +0200 Subject: [PATCH] bug: fix updater always failing --- rust/updater/src/updater.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rust/updater/src/updater.rs b/rust/updater/src/updater.rs index 54fc6586e..ca0a9a8f6 100644 --- a/rust/updater/src/updater.rs +++ b/rust/updater/src/updater.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration}; use async_trait::async_trait; use color_eyre::{ - eyre::{ensure, eyre, Context}, + eyre::{bail, ensure, Context}, Result, }; use ethers::{core::types::H256, signers::Signer, types::Address}; @@ -119,8 +119,9 @@ impl UpdateHandler { // can check and enter the below `if` block at a time, // protecting from races between threads. - self.check_conflict(&update) - .ok_or_else(|| eyre!("Found conflicting update in DB"))?; + if self.check_conflict(&update).is_some() { + bail!("Found conflicting update in DB"); + } // If we have a conflict, we grab that one instead let signed = update.sign_with(self.signer.as_ref()).await.unwrap();