diff --git a/cw_core/lib/unspent_transaction_output.dart b/cw_core/lib/unspent_transaction_output.dart index da71f6983..31820e3a1 100644 --- a/cw_core/lib/unspent_transaction_output.dart +++ b/cw_core/lib/unspent_transaction_output.dart @@ -21,4 +21,9 @@ class Unspent with UnspentComparable { bool get isP2wpkh => address.startsWith('bc') || address.startsWith('tb') || address.startsWith('ltc'); + + @override + String toString() { + return 'Unspent(address: $address, hash: $hash, value: $value, vout: $vout, keyImage: $keyImage, isSending: $isSending, isFrozen: $isFrozen, isChange: $isChange, note: $note)'; + } } diff --git a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart index 5136ead1e..bae4677cf 100644 --- a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart +++ b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart @@ -156,8 +156,8 @@ abstract class UnspentCoinsListViewModelBase with Store { await _updateUnspents(); Set seen = {}; for (final item in _getSpecificUnspents(overrideCoinTypeToSpendFrom)) { - if (seen.contains(item.hash)) continue; - seen.add(item.hash); + if (seen.contains(item.toString())) continue; + seen.add(item.toString()); if (item.isFrozen || !item.isSending) continue; total += item.value; } @@ -166,8 +166,6 @@ abstract class UnspentCoinsListViewModelBase with Store { @action void _updateUnspentCoinsInfo() { - items.clear(); - final unspents = _getUnspents() .map((elem) { try { @@ -201,7 +199,7 @@ abstract class UnspentCoinsListViewModelBase with Store { .toList(); unspents.sort((a, b) => b.value.compareTo(a.value)); - + items.clear(); items.addAll(unspents); }