reset address balances before updating unspents (#1707)

This commit is contained in:
Serhii 2024-09-28 02:02:37 +03:00 committed by GitHub
parent b6e8970dca
commit 4c55d96647
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1272,6 +1272,11 @@ abstract class ElectrumWalletBase
}); });
} }
// Set the balance of all non-silent payment addresses to 0 before updating
walletAddresses.allAddresses.forEach((addr) {
if(addr is! BitcoinSilentPaymentAddressRecord) addr.balance = 0;
});
await Future.wait(walletAddresses.allAddresses.map((address) async { await Future.wait(walletAddresses.allAddresses.map((address) async {
updatedUnspentCoins.addAll(await fetchUnspent(address)); updatedUnspentCoins.addAll(await fetchUnspent(address));
})); }));