TransactionInput: convert an if-else into expression with ternary operator

This commit is contained in:
Andreas Schildbach 2023-08-08 11:54:34 +02:00
parent 2b68d8da8e
commit 0a58d0a5c3

View file

@ -143,12 +143,9 @@ public class TransactionInput {
*/ */
TransactionInput(Transaction parentTransaction, TransactionOutput output) { TransactionInput(Transaction parentTransaction, TransactionOutput output) {
super(); super();
long outputIndex = output.getIndex(); outpoint = output.getParentTransaction() != null ?
if(output.getParentTransaction() != null ) { new TransactionOutPoint(output.getIndex(), output.getParentTransaction()) :
outpoint = new TransactionOutPoint(outputIndex, output.getParentTransaction()); new TransactionOutPoint(output);
} else {
outpoint = new TransactionOutPoint(output);
}
scriptBytes = EMPTY_ARRAY; scriptBytes = EMPTY_ARRAY;
sequence = NO_SEQUENCE; sequence = NO_SEQUENCE;
setParent(parentTransaction); setParent(parentTransaction);