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) =>
transactions[transaction.id] = transaction;
}

View file

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

View file

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

View file

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