diff --git a/src/main/java/com/craigraw/drongo/protocol/TransactionInput.java b/src/main/java/com/craigraw/drongo/protocol/TransactionInput.java index 26515f5..9ecd4de 100644 --- a/src/main/java/com/craigraw/drongo/protocol/TransactionInput.java +++ b/src/main/java/com/craigraw/drongo/protocol/TransactionInput.java @@ -82,6 +82,11 @@ public class TransactionInput extends TransactionPart { this.sequence = sequence; } + public int getIndex() { + Transaction transaction = (Transaction)parent; + return transaction.getInputs().indexOf(this); + } + /** * Coinbase transactions have special inputs with hashes of zero. If this is such an input, returns true. */ diff --git a/src/main/java/com/craigraw/drongo/protocol/TransactionOutput.java b/src/main/java/com/craigraw/drongo/protocol/TransactionOutput.java index 7bfd0b9..6093ee4 100644 --- a/src/main/java/com/craigraw/drongo/protocol/TransactionOutput.java +++ b/src/main/java/com/craigraw/drongo/protocol/TransactionOutput.java @@ -77,4 +77,9 @@ public class TransactionOutput extends TransactionPart { public void setAddresses(Address[] addresses) { this.addresses = addresses; } + + public int getIndex() { + Transaction transaction = (Transaction)parent; + return transaction.getOutputs().indexOf(this); + } }