ensure selected utxo sets retain stable ordering

This commit is contained in:
Craig Raw 2021-12-13 15:42:02 +02:00
parent 20ec0f95fb
commit 3131b265a5

View file

@ -932,7 +932,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
Map<BlockTransactionHashIndex, WalletNode> utxos = getWalletUtxos(includeSpentMempoolOutputs);
for(Collection<BlockTransactionHashIndex> selectedInputs : selectedInputSets) {
total += selectedInputs.stream().mapToLong(BlockTransactionHashIndex::getValue).sum();
Map<BlockTransactionHashIndex, WalletNode> selectedInputsMap = new HashMap<>(utxos);
Map<BlockTransactionHashIndex, WalletNode> selectedInputsMap = new TreeMap<>(utxos);
selectedInputsMap.keySet().retainAll(selectedInputs);
selectedInputSetsList.add(selectedInputsMap);
}