mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-25 17:46:44 +00:00
shuffle utxos within input sets
This commit is contained in:
parent
6ac593f161
commit
8ac3f47380
1 changed files with 6 additions and 2 deletions
|
@ -932,8 +932,12 @@ 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 TreeMap<>(utxos);
|
||||
selectedInputsMap.keySet().retainAll(selectedInputs);
|
||||
Map<BlockTransactionHashIndex, WalletNode> selectedInputsMap = new LinkedHashMap<>();
|
||||
List<BlockTransactionHashIndex> shuffledInputs = new ArrayList<>(selectedInputs);
|
||||
Collections.shuffle(shuffledInputs);
|
||||
for(BlockTransactionHashIndex shuffledInput : shuffledInputs) {
|
||||
selectedInputsMap.put(shuffledInput, utxos.get(shuffledInput));
|
||||
}
|
||||
selectedInputSetsList.add(selectedInputsMap);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue