mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 16:55:58 +00:00
fix Electrum transaction updates (#953)
This commit is contained in:
parent
a7ba4a84e8
commit
f88e150cd1
1 changed files with 3 additions and 15 deletions
|
@ -35,7 +35,7 @@ abstract class ElectrumTransactionHistoryBase
|
|||
|
||||
@override
|
||||
void addMany(Map<String, ElectrumTransactionInfo> transactions) =>
|
||||
transactions.forEach((_, tx) => _updateOrInsert(tx));
|
||||
transactions.forEach((_, tx) => _update(tx));
|
||||
|
||||
@override
|
||||
Future<void> save() async {
|
||||
|
@ -74,7 +74,7 @@ abstract class ElectrumTransactionHistoryBase
|
|||
|
||||
if (val is Map<String, dynamic>) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue