Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public Transaction[] handleTxs(Transaction[] possibleTxs) {
Set<Transaction> sortedTxs = new TreeSet<>(
(x, y) ->, this.makeTxFees(x)));
Collections.addAll(sortedTxs, possibleTxs);
Set<Transaction> validTxs = new HashSet<>();
sortedTxs.parallelStream().filter(this::isValidTx).map(tx -> {
tx.getInputs().parallelStream().map(in -> {
UTXO utxo = new UTXO(in.prevTxHash, in.outputIndex);
return null;
IntStream.range(0, tx.numInputs()).map(i -> {
Transaction.Output output = tx.getOutput(i);
UTXO utxo = new UTXO(tx.getHash(), i);
this.utxoPool.addUTXO(utxo, output);
return 0;
return null;
Transaction[] validTxsArray = new Transaction[validTxs.size()];
return validTxs.toArray(validTxsArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.