From 4503ad540166e179fbf930347036402851ed5577 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 13 Sep 2024 13:03:02 -0700 Subject: [PATCH] works for simple mweb-mweb case, further testing needed --- cw_bitcoin/lib/litecoin_wallet.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cw_bitcoin/lib/litecoin_wallet.dart b/cw_bitcoin/lib/litecoin_wallet.dart index 8b2861af0..47b014bb9 100644 --- a/cw_bitcoin/lib/litecoin_wallet.dart +++ b/cw_bitcoin/lib/litecoin_wallet.dart @@ -676,13 +676,14 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { try { mwebUtxosBox.values.forEach((utxo) { if (utxo.height > 0) { - // confirmed += utxo.value.toInt(); confirmedMweb += utxo.value.toInt(); } else { - // unconfirmed += utxo.value.toInt(); unconfirmedMweb += utxo.value.toInt(); } }); + if (confirmedMweb > 0 && unconfirmedMweb > 0) { + unconfirmedMweb = -1 * (confirmedMweb - unconfirmedMweb); + } } catch (_) {} // update unspent balances: @@ -872,7 +873,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { final addresses = {}; transaction.inputAddresses?.forEach((id) async { final utxo = mwebUtxosBox.get(id); - await mwebUtxosBox.delete(id); + // await mwebUtxosBox.delete(id); if (utxo == null) return; final addressRecord = walletAddresses.allAddresses .firstWhere((addressRecord) => addressRecord.address == utxo.address);