From 993e8b7ebf763450aabb8574bc7c65f4e94813c9 Mon Sep 17 00:00:00 2001 From: Serhii Date: Tue, 3 Jan 2023 23:59:08 +0200 Subject: [PATCH] fix disappearance of pending transaction --- cw_bitcoin/lib/electrum_transaction_history.dart | 6 ++---- cw_bitcoin/lib/electrum_transaction_info.dart | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cw_bitcoin/lib/electrum_transaction_history.dart b/cw_bitcoin/lib/electrum_transaction_history.dart index f8662eb95..9174fb3f8 100644 --- a/cw_bitcoin/lib/electrum_transaction_history.dart +++ b/cw_bitcoin/lib/electrum_transaction_history.dart @@ -72,7 +72,7 @@ abstract class ElectrumTransactionHistoryBase txs.entries.forEach((entry) { final val = entry.value; - if (val is Map) { + if (val is Map) { final tx = ElectrumTransactionInfo.fromJson(val, walletInfo.type); _updateOrInsert(tx); } @@ -85,9 +85,6 @@ abstract class ElectrumTransactionHistoryBase } void _updateOrInsert(ElectrumTransactionInfo transaction) { - if (transaction.id == null) { - return; - } if (transactions[transaction.id] == null) { transactions[transaction.id] = transaction; @@ -98,6 +95,7 @@ abstract class ElectrumTransactionHistoryBase originalTx?.height = transaction.height; originalTx?.date ??= transaction.date; originalTx?.isPending = transaction.isPending; + originalTx?.direction = transaction.direction; } } } diff --git a/cw_bitcoin/lib/electrum_transaction_info.dart b/cw_bitcoin/lib/electrum_transaction_info.dart index 6e85a2f88..8d6ef0fea 100644 --- a/cw_bitcoin/lib/electrum_transaction_info.dart +++ b/cw_bitcoin/lib/electrum_transaction_info.dart @@ -228,9 +228,7 @@ class ElectrumTransactionInfo extends TransactionInfo { m['id'] = id; m['height'] = height; m['amount'] = amount; - // FIX-ME: Hardcoded value - // m['direction'] = direction.index; - m['direction'] = 0; + m['direction'] = direction.index; m['date'] = date.millisecondsSinceEpoch; m['isPending'] = isPending; m['confirmations'] = confirmations;