3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 06:44:16 +00:00

Remove redundant TransactionOutput constructor

This commit is contained in:
Matt Corallo 2012-08-29 22:07:09 -04:00 committed by Mike Hearn
parent f3d9c02841
commit 9585729398
4 changed files with 3 additions and 14 deletions

View File

@ -892,7 +892,7 @@ public class Block extends Message {
// Here we will do things a bit differently so a new address isn't needed every time. We'll put a simple
// counter in the scriptSig so every transaction has a different hash.
coinbase.addInput(new TransactionInput(params, coinbase, new byte[]{(byte) txCounter++, (byte) 1}));
coinbase.addOutput(new TransactionOutput(params, coinbase, Script.createOutputScript(pubKeyTo), value));
coinbase.addOutput(new TransactionOutput(params, coinbase, value, Script.createOutputScript(pubKeyTo)));
transactions.add(coinbase);
coinbase.setParent(this);
coinbase.length = coinbase.bitcoinSerialize().length;

View File

@ -150,7 +150,7 @@ public class NetworkParameters implements Serializable {
Script.writeBytes(scriptPubKeyBytes, Hex.decode
("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"));
scriptPubKeyBytes.write(Script.OP_CHECKSIG);
t.addOutput(new TransactionOutput(n, t, scriptPubKeyBytes.toByteArray(), Utils.toNanoCoins(50, 0)));
t.addOutput(new TransactionOutput(n, t, Utils.toNanoCoins(50, 0), scriptPubKeyBytes.toByteArray()));
} catch (Exception e) {
// Cannot happen.
throw new RuntimeException(e);

View File

@ -152,7 +152,7 @@ public class Transaction extends ChildMessage implements Serializable {
this.inputs = new ArrayList<TransactionInput>(tx.getInputs());
this.outputs = new ArrayList<TransactionOutput>(tx.getOutputs().size());
for (StoredTransactionOutput output : tx.getOutputs()) {
this.outputs.add(new TransactionOutput(params, this, output.getScriptBytes(), output.getValue()));
this.outputs.add(new TransactionOutput(params, this, output.getValue(), output.getScriptBytes()));
}
}

View File

@ -111,17 +111,6 @@ public class TransactionOutput extends ChildMessage implements Serializable {
length = 8 + VarInt.sizeOf(scriptBytes.length) + scriptBytes.length;
}
/**
* Used only in creation of the genesis blocks and in unit tests.
*/
TransactionOutput(NetworkParameters params, Transaction parent, byte[] scriptBytes, BigInteger value) {
super(params);
this.scriptBytes = scriptBytes;
this.value = value;
parentTransaction = parent;
availableForSpending = true;
}
public Script getScriptPubKey() throws ScriptException {
if (scriptPubKey == null) {
maybeParse();