3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +00:00

Add some convenience getters to a couple of classes.

This commit is contained in:
Mike Hearn 2013-01-16 17:50:13 +01:00
parent 9382ee15e9
commit ee715a5f59
2 changed files with 19 additions and 0 deletions

View File

@ -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));
}
}

View File

@ -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) {