From f88e150cd18d4d89ed135c79f59e7c3988185756 Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 14 Jun 2023 23:53:58 +0300 Subject: [PATCH] fix Electrum transaction updates (#953) --- .../lib/electrum_transaction_history.dart | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/cw_bitcoin/lib/electrum_transaction_history.dart b/cw_bitcoin/lib/electrum_transaction_history.dart index 9174fb3f8..209c35140 100644 --- a/cw_bitcoin/lib/electrum_transaction_history.dart +++ b/cw_bitcoin/lib/electrum_transaction_history.dart @@ -35,7 +35,7 @@ abstract class ElectrumTransactionHistoryBase @override void addMany(Map transactions) => - transactions.forEach((_, tx) => _updateOrInsert(tx)); + transactions.forEach((_, tx) => _update(tx)); @override Future save() async { @@ -74,7 +74,7 @@ abstract class ElectrumTransactionHistoryBase if (val is Map) { final tx = ElectrumTransactionInfo.fromJson(val, walletInfo.type); - _updateOrInsert(tx); + _update(tx); } }); @@ -84,18 +84,6 @@ abstract class ElectrumTransactionHistoryBase } } - void _updateOrInsert(ElectrumTransactionInfo transaction) { - - if (transactions[transaction.id] == null) { + void _update(ElectrumTransactionInfo transaction) => transactions[transaction.id] = transaction; - } else { - final originalTx = transactions[transaction.id]; - originalTx?.confirmations = transaction.confirmations; - originalTx?.amount = transaction.amount; - originalTx?.height = transaction.height; - originalTx?.date ??= transaction.date; - originalTx?.isPending = transaction.isPending; - originalTx?.direction = transaction.direction; - } - } }