From 8595562f75a6ddbe6d9272a1c4b6185f8f3fa187 Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli Date: Wed, 13 Nov 2024 09:56:35 +0100 Subject: [PATCH] do not error on empty changeset --- chain/src/repository/pos.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chain/src/repository/pos.rs b/chain/src/repository/pos.rs index 56aa3800..6c4a096e 100644 --- a/chain/src/repository/pos.rs +++ b/chain/src/repository/pos.rs @@ -3,8 +3,7 @@ use std::collections::HashSet; use anyhow::Context; use diesel::upsert::excluded; use diesel::{ - BoolExpressionMethods, ExpressionMethods, PgConnection, QueryDsl, - RunQueryDsl, SelectableHelper, + BoolExpressionMethods, ExpressionMethods, OptionalEmptyChangesetExtension, PgConnection, QueryDsl, RunQueryDsl, SelectableHelper }; use orm::bond::BondInsertDb; use orm::schema::{bonds, pos_rewards, unbonds, validators}; @@ -195,6 +194,7 @@ pub fn update_validator_metadata( .set(metadata_change_db) .filter(validators::namada_address.eq(metadata.address.to_string())) .execute(transaction_conn) + .optional_empty_changeset() .context("Failed to update unbonds in db")?; } anyhow::Ok(())