reset address balances before updating unspents (#1707)

Serhii committed Sep 28, 2024 at 02:02 UTC 4c55d9664763adef4443202bf2f0d4b0283e868c
1 file changed +5
cw_bitcoin/lib/electrum_wallet.dart
+5
@@ -1272,6 +1272,11 @@ abstract class ElectrumWalletBase
1272 });
1273 }
1274
1275 + // Set the balance of all non-silent payment addresses to 0 before updating
1276 + walletAddresses.allAddresses.forEach((addr) {
1277 + if(addr is! BitcoinSilentPaymentAddressRecord) addr.balance = 0;
1278 + });
1279 +
1280 await Future.wait(walletAddresses.allAddresses.map((address) async {
1281 updatedUnspentCoins.addAll(await fetchUnspent(address));
1282 }));