From f3d12196530f9bf7c266cba9eff014cba04cecbb Mon Sep 17 00:00:00 2001 From: SW van Heerden Date: Mon, 26 Feb 2024 10:49:33 +0200 Subject: [PATCH] fix: oms validation (#6161) Description --- Fixes the OMS validation to invalidate unmined utxos and not keep them pending Motivation and Context --- Although these utxo would never reach spending, the wallet sees them as pending incoming or pending outgoing. We need to ensure their status is correctly set. --- .../tasks/txo_validation_task.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs b/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs index f5aaeadb8b..2f7c37475a 100644 --- a/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs +++ b/base_layer/wallet/src/output_manager_service/tasks/txo_validation_task.rs @@ -46,6 +46,7 @@ use crate::{ storage::{ database::{OutputManagerBackend, OutputManagerDatabase}, models::DbWalletOutput, + OutputStatus, }, }, }; @@ -318,6 +319,20 @@ where ) .await?; } + for unmined_output in unmined { + if unmined_output.status == OutputStatus::UnspentMinedUnconfirmed { + info!( + target: LOG_TARGET, + "Updating output comm:{}: hash {} as unmined(Operation ID: {})", + unmined_output.commitment.to_hex(), + unmined_output.hash.to_hex(), + self.operation_id + ); + self.db + .set_output_to_unmined_and_invalid(unmined_output.hash) + .for_protocol(self.operation_id)?; + } + } } Ok(())