CW-214-Monero-wallet-rescan-bug (#945)

* clear transactionHistory before rescan

* move the clear method to the abstract class
This commit is contained in:
Serhii 2023-07-11 20:56:01 +03:00 committed by GitHub
parent 181fd21636
commit 02fd12f5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 0 deletions

View file

@ -86,4 +86,5 @@ abstract class ElectrumTransactionHistoryBase
void _update(ElectrumTransactionInfo transaction) => void _update(ElectrumTransactionInfo transaction) =>
transactions[transaction.id] = transaction; transactions[transaction.id] = transaction;
} }

View file

@ -14,6 +14,8 @@ abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
void addMany(Map<String, TransactionType> transactions); void addMany(Map<String, TransactionType> transactions);
void clear() => transactions.clear();
// bool _isUpdating; // bool _isUpdating;
// @action // @action

View file

@ -24,4 +24,5 @@ abstract class MoneroTransactionHistoryBase
@override @override
void addMany(Map<String, MoneroTransactionInfo> transactions) => void addMany(Map<String, MoneroTransactionInfo> transactions) =>
this.transactions.addAll(transactions); this.transactions.addAll(transactions);
} }

View file

@ -24,6 +24,7 @@ abstract class RescanViewModelBase with Store {
Future<void> rescanCurrentWallet({required int restoreHeight}) async { Future<void> rescanCurrentWallet({required int restoreHeight}) async {
state = RescanWalletState.rescaning; state = RescanWalletState.rescaning;
await _wallet.rescan(height: restoreHeight); await _wallet.rescan(height: restoreHeight);
_wallet.transactionHistory.clear();
state = RescanWalletState.none; state = RescanWalletState.none;
} }
} }