From e95ce8b50db02891966286c80a11f9717072d1f8 Mon Sep 17 00:00:00 2001 From: Dusan Stanivukovic Date: Tue, 6 Aug 2024 16:04:43 +0200 Subject: [PATCH] [TRIVIAL] Move commit to bottom of OnSettlementEventUpdater (#2864) # Description Moves committing to database bellow the temporary added code that builds the domain::Settlement because domain:Settlement reports `WrongEnvironment` for each settlement if settlement is already processed (saved to database). This is needed to test the new Settlement code. --- crates/autopilot/src/on_settlement_event_updater.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/autopilot/src/on_settlement_event_updater.rs b/crates/autopilot/src/on_settlement_event_updater.rs index ab2da19e97..8d1135411c 100644 --- a/crates/autopilot/src/on_settlement_event_updater.rs +++ b/crates/autopilot/src/on_settlement_event_updater.rs @@ -177,11 +177,6 @@ impl Inner { tracing::debug!(?hash, ?update, "updating settlement details for tx"); - Postgres::update_settlement_details(&mut ex, update.clone()) - .await - .with_context(|| format!("insert_settlement_details: {update:?}"))?; - ex.commit().await?; - { // temporary to debug and compare with current implementation // TODO: use instead of current implementation @@ -203,6 +198,11 @@ impl Inner { ); } + Postgres::update_settlement_details(&mut ex, update.clone()) + .await + .with_context(|| format!("insert_settlement_details: {update:?}"))?; + ex.commit().await?; + Ok(true) }