3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-19 13:45:48 +00:00

Transaction: Rework JavaDoc of the addInput() variants.

This commit is contained in:
Andreas Schildbach 2016-05-06 10:27:04 +02:00
parent 0b3cc9c59f
commit 01890c563c

View File

@ -22,6 +22,7 @@ import org.bitcoinj.crypto.TransactionSignature;
import org.bitcoinj.script.Script; import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptBuilder; import org.bitcoinj.script.ScriptBuilder;
import org.bitcoinj.script.ScriptOpCodes; import org.bitcoinj.script.ScriptOpCodes;
import org.bitcoinj.signers.TransactionSigner;
import org.bitcoinj.utils.ExchangeRate; import org.bitcoinj.utils.ExchangeRate;
import org.bitcoinj.wallet.Wallet; import org.bitcoinj.wallet.Wallet;
import org.bitcoinj.wallet.WalletTransaction.Pool; import org.bitcoinj.wallet.WalletTransaction.Pool;
@ -748,16 +749,20 @@ public class Transaction extends ChildMessage {
} }
/** /**
* Adds an input to this transaction that imports value from the given output. Note that this input is NOT * Adds an input to this transaction that imports value from the given output. Note that this input is <i>not</i>
* complete and after every input is added with addInput() and every output is added with addOutput(), * complete and after every input is added with {@link #addInput()} and every output is added with
* signInputs() must be called to finalize the transaction and finish the inputs off. Otherwise it won't be * {@link #addOutput()}, a {@link TransactionSigner} must be used to finalize the transaction and finish the inputs
* accepted by the network. Returns the newly created input. * off. Otherwise it won't be accepted by the network.
* @return the newly created input.
*/ */
public TransactionInput addInput(TransactionOutput from) { public TransactionInput addInput(TransactionOutput from) {
return addInput(new TransactionInput(params, this, from)); return addInput(new TransactionInput(params, this, from));
} }
/** Adds an input directly, with no checking that it's valid. Returns the new input. */ /**
* Adds an input directly, with no checking that it's valid.
* @return the new input.
*/
public TransactionInput addInput(TransactionInput input) { public TransactionInput addInput(TransactionInput input) {
unCache(); unCache();
input.setParent(this); input.setParent(this);
@ -766,7 +771,10 @@ public class Transaction extends ChildMessage {
return input; return input;
} }
/** Adds an input directly, with no checking that it's valid. Returns the new input. */ /**
* Creates and adds an input to this transaction, with no checking that it's valid.
* @return the newly created input.
*/
public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) { public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) {
return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash))); return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash)));
} }