fix disappearance of pending transaction

This commit is contained in:
Serhii 2023-01-03 23:59:08 +02:00
parent a0e98e6d90
commit 993e8b7ebf
2 changed files with 3 additions and 7 deletions

View file

@ -72,7 +72,7 @@ abstract class ElectrumTransactionHistoryBase
txs.entries.forEach((entry) { txs.entries.forEach((entry) {
final val = entry.value; final val = entry.value;
if (val is Map<String, Object>) { if (val is Map<String, dynamic>) {
final tx = ElectrumTransactionInfo.fromJson(val, walletInfo.type); final tx = ElectrumTransactionInfo.fromJson(val, walletInfo.type);
_updateOrInsert(tx); _updateOrInsert(tx);
} }
@ -85,9 +85,6 @@ abstract class ElectrumTransactionHistoryBase
} }
void _updateOrInsert(ElectrumTransactionInfo transaction) { void _updateOrInsert(ElectrumTransactionInfo transaction) {
if (transaction.id == null) {
return;
}
if (transactions[transaction.id] == null) { if (transactions[transaction.id] == null) {
transactions[transaction.id] = transaction; transactions[transaction.id] = transaction;
@ -98,6 +95,7 @@ abstract class ElectrumTransactionHistoryBase
originalTx?.height = transaction.height; originalTx?.height = transaction.height;
originalTx?.date ??= transaction.date; originalTx?.date ??= transaction.date;
originalTx?.isPending = transaction.isPending; originalTx?.isPending = transaction.isPending;
originalTx?.direction = transaction.direction;
} }
} }
} }

View file

@ -228,9 +228,7 @@ class ElectrumTransactionInfo extends TransactionInfo {
m['id'] = id; m['id'] = id;
m['height'] = height; m['height'] = height;
m['amount'] = amount; m['amount'] = amount;
// FIX-ME: Hardcoded value m['direction'] = direction.index;
// m['direction'] = direction.index;
m['direction'] = 0;
m['date'] = date.millisecondsSinceEpoch; m['date'] = date.millisecondsSinceEpoch;
m['isPending'] = isPending; m['isPending'] = isPending;
m['confirmations'] = confirmations; m['confirmations'] = confirmations;