From 02fd12f5f885c21674af12f988fac0f461007bed Mon Sep 17 00:00:00 2001 From: Serhii Date: Tue, 11 Jul 2023 20:56:01 +0300 Subject: [PATCH] CW-214-Monero-wallet-rescan-bug (#945) * clear transactionHistory before rescan * move the clear method to the abstract class --- cw_bitcoin/lib/electrum_transaction_history.dart | 1 + cw_core/lib/transaction_history.dart | 2 ++ cw_monero/lib/monero_transaction_history.dart | 1 + lib/view_model/rescan_view_model.dart | 1 + 4 files changed, 5 insertions(+) diff --git a/cw_bitcoin/lib/electrum_transaction_history.dart b/cw_bitcoin/lib/electrum_transaction_history.dart index 209c35140..8720dd82c 100644 --- a/cw_bitcoin/lib/electrum_transaction_history.dart +++ b/cw_bitcoin/lib/electrum_transaction_history.dart @@ -86,4 +86,5 @@ abstract class ElectrumTransactionHistoryBase void _update(ElectrumTransactionInfo transaction) => transactions[transaction.id] = transaction; + } diff --git a/cw_core/lib/transaction_history.dart b/cw_core/lib/transaction_history.dart index 508f3aeca..a88d6df95 100644 --- a/cw_core/lib/transaction_history.dart +++ b/cw_core/lib/transaction_history.dart @@ -14,6 +14,8 @@ abstract class TransactionHistoryBase { void addMany(Map transactions); + void clear() => transactions.clear(); + // bool _isUpdating; // @action diff --git a/cw_monero/lib/monero_transaction_history.dart b/cw_monero/lib/monero_transaction_history.dart index 229357c1b..e23f70530 100644 --- a/cw_monero/lib/monero_transaction_history.dart +++ b/cw_monero/lib/monero_transaction_history.dart @@ -24,4 +24,5 @@ abstract class MoneroTransactionHistoryBase @override void addMany(Map transactions) => this.transactions.addAll(transactions); + } diff --git a/lib/view_model/rescan_view_model.dart b/lib/view_model/rescan_view_model.dart index 632d9ef0c..c973b7b3f 100644 --- a/lib/view_model/rescan_view_model.dart +++ b/lib/view_model/rescan_view_model.dart @@ -24,6 +24,7 @@ abstract class RescanViewModelBase with Store { Future rescanCurrentWallet({required int restoreHeight}) async { state = RescanWalletState.rescaning; await _wallet.rescan(height: restoreHeight); + _wallet.transactionHistory.clear(); state = RescanWalletState.none; } } \ No newline at end of file