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

* clear transactionHistory before rescan * move the clear method to the abstract class

Serhii committed Jul 11, 2023 at 20:56 UTC 02fd12f5f885c21674af12f988fac0f461007bed
4 files changed +5
cw_bitcoin/lib/electrum_transaction_history.dart
+1
@@ -86,4 +86,5 @@ abstract class ElectrumTransactionHistoryBase
86
87 void _update(ElectrumTransactionInfo transaction) =>
88 transactions[transaction.id] = transaction;
89 +
90 }
cw_core/lib/transaction_history.dart
+2
@@ -14,6 +14,8 @@ abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
14
15 void addMany(Map<String, TransactionType> transactions);
16
17 + void clear() => transactions.clear();
18 +
19 // bool _isUpdating;
20
21 // @action
cw_monero/lib/monero_transaction_history.dart
+1
@@ -24,4 +24,5 @@ abstract class MoneroTransactionHistoryBase
24 @override
25 void addMany(Map<String, MoneroTransactionInfo> transactions) =>
26 this.transactions.addAll(transactions);
27 +
28 }
lib/view_model/rescan_view_model.dart
+1
@@ -24,6 +24,7 @@ abstract class RescanViewModelBase with Store {
24 Future<void> rescanCurrentWallet({required int restoreHeight}) async {
25 state = RescanWalletState.rescaning;
26 await _wallet.rescan(height: restoreHeight);
27 + _wallet.transactionHistory.clear();
28 state = RescanWalletState.none;
29 }
30 }
\ No newline at end of file