diff --git a/core/src/main/java/com/google/bitcoin/core/GetDataMessage.java b/core/src/main/java/com/google/bitcoin/core/GetDataMessage.java index 2f657637..55f74385 100644 --- a/core/src/main/java/com/google/bitcoin/core/GetDataMessage.java +++ b/core/src/main/java/com/google/bitcoin/core/GetDataMessage.java @@ -47,4 +47,12 @@ public class GetDataMessage extends ListMessage { public GetDataMessage(NetworkParameters params) { super(params); } + + public void addTransaction(Sha256Hash hash) { + addItem(new InventoryItem(InventoryItem.Type.Transaction, hash)); + } + + public void addBlock(Sha256Hash hash) { + addItem(new InventoryItem(InventoryItem.Type.Block, hash)); + } } diff --git a/core/src/main/java/com/google/bitcoin/core/Transaction.java b/core/src/main/java/com/google/bitcoin/core/Transaction.java index 58c57180..40e79626 100644 --- a/core/src/main/java/com/google/bitcoin/core/Transaction.java +++ b/core/src/main/java/com/google/bitcoin/core/Transaction.java @@ -941,6 +941,17 @@ public class Transaction extends ChildMessage implements Serializable { maybeParse(); return Collections.unmodifiableList(outputs); } + + /** @return the given transaction: same as getInputs().get(index). */ + public TransactionInput getInput(int index) { + maybeParse(); + return inputs.get(index); + } + + public TransactionOutput getOutput(int index) { + maybeParse(); + return outputs.get(index); + } public synchronized TransactionConfidence getConfidence() { if (confidence == null) {