Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public double makeTxFees(Transaction tx) {
if (!this.isValidTx(tx)) {
return 0;
double inputValuesSum = tx.getInputs()
.map((x) -> new UTXO(x.prevTxHash, x.outputIndex))
.filter((x) -> this.utxoPool.contains(x))
.mapToDouble((x) -> this.utxoPool.getTxOutput(x).value)
double outputValuesSum = tx.getOutputs()
.mapToDouble((x) -> x.value)
return inputValuesSum - outputValuesSum;
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.