From 83ab2da56dcf21e5b15e1e08ab788039e20f8ea6 Mon Sep 17 00:00:00 2001 From: sword-smith Date: Mon, 24 Jul 2023 23:43:15 +0200 Subject: [PATCH] Use new MUTXO field `abandoned_at` in resync and wallet-block updater --- src/models/state/mod.rs | 5 +++++ src/models/state/wallet/wallet_state.rs | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/models/state/mod.rs b/src/models/state/mod.rs index d1a33938..4e62c582 100644 --- a/src/models/state/mod.rs +++ b/src/models/state/mod.rs @@ -370,6 +370,11 @@ impl GlobalState { 'outer: for i in 0..num_monitored_utxos { let mut monitored_utxo = monitored_utxos.get(i).clone(); + // Ignore those MUTXOs that were marked as abandoned + if monitored_utxo.abandoned_at.is_some() { + continue; + } + // ignore synced ones if monitored_utxo.is_synced_to(&tip_hash) { continue; diff --git a/src/models/state/wallet/wallet_state.rs b/src/models/state/wallet/wallet_state.rs index 01059d0d..391f417d 100644 --- a/src/models/state/wallet/wallet_state.rs +++ b/src/models/state/wallet/wallet_state.rs @@ -349,9 +349,17 @@ impl WalletState { "Strong key must be unique in wallet DB" ); } - None => warn!( - "Unable to find valid membership proof for UTXO with digest {utxo_digest}" - ), + None => { + // Was MUTXO marked as abandoned? Then this is fine. Otherwise, log a warning. + // TODO: If MUTXO was spent, maybe we also don't want to maintain it? + if monitored_utxo.abandoned_at.is_some() { + debug!("Monitored UTXO with digest {utxo_digest} was marked as abandoned. Skipping."); + } else { + warn!( + "Unable to find valid membership proof for UTXO with digest {utxo_digest}" + ); + } + } } }