mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 23:32:16 +00:00
Make Transaction.addInput(TransactionOutput) return the created input. Use it to make a minor simplification.
This commit is contained in:
parent
6077d32c4a
commit
b865e6a510
@ -665,8 +665,10 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||||||
* signInputs() must be called to finalize the transaction and finish the inputs off. Otherwise it won't be
|
* signInputs() must be called to finalize the transaction and finish the inputs off. Otherwise it won't be
|
||||||
* accepted by the network.
|
* accepted by the network.
|
||||||
*/
|
*/
|
||||||
public void addInput(TransactionOutput from) {
|
public TransactionInput addInput(TransactionOutput from) {
|
||||||
addInput(new TransactionInput(params, this, from));
|
final TransactionInput input = new TransactionInput(params, this, from);
|
||||||
|
addInput(input);
|
||||||
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3171,9 +3171,9 @@ public class Wallet implements Serializable, BlockChainListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (TransactionOutput output : selection.gathered) {
|
for (TransactionOutput output : selection.gathered) {
|
||||||
req.tx.addInput(output);
|
TransactionInput input = req.tx.addInput(output);
|
||||||
// If the scriptBytes don't default to none, our size calculations will be thrown off
|
// If the scriptBytes don't default to none, our size calculations will be thrown off.
|
||||||
checkState(req.tx.getInput(req.tx.getInputs().size()-1).getScriptBytes().length == 0);
|
checkState(input.getScriptBytes().length == 0);
|
||||||
try {
|
try {
|
||||||
if (output.getScriptPubKey().isSentToAddress()) {
|
if (output.getScriptPubKey().isSentToAddress()) {
|
||||||
// Send-to-address spends usually take maximum pubkey.length (as it may be compressed or not) + 75 bytes
|
// Send-to-address spends usually take maximum pubkey.length (as it may be compressed or not) + 75 bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user