consistently order unspent coins / prevent coins jumping around

This commit is contained in:
Matthew Fosse 2024-11-21 12:09:28 -07:00
parent ff5fbd7946
commit 096282032b

View file

@ -146,6 +146,15 @@ abstract class UnspentCoinsListViewModelBase with Store {
} }
}); });
// sort by hash so that even if the addresses are the same, they don't jump around when selected (because that calls updateBalance)
unspents.sort((a, b) => a.hash.compareTo(b.hash));
// sort unspents by address so that if something changes it's easier to see:
unspents.sort((a, b) => a.address.compareTo(b.address));
// sort change addresses to the end:
// unspents.sort((a, b) => a.isChange ? 1 : -1);
_items.addAll(unspents); _items.addAll(unspents);
} }
} }