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:
parent
f3d9c02841
commit
9585729398
@ -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
|
// 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.
|
// counter in the scriptSig so every transaction has a different hash.
|
||||||
coinbase.addInput(new TransactionInput(params, coinbase, new byte[]{(byte) txCounter++, (byte) 1}));
|
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);
|
transactions.add(coinbase);
|
||||||
coinbase.setParent(this);
|
coinbase.setParent(this);
|
||||||
coinbase.length = coinbase.bitcoinSerialize().length;
|
coinbase.length = coinbase.bitcoinSerialize().length;
|
||||||
|
@ -150,7 +150,7 @@ public class NetworkParameters implements Serializable {
|
|||||||
Script.writeBytes(scriptPubKeyBytes, Hex.decode
|
Script.writeBytes(scriptPubKeyBytes, Hex.decode
|
||||||
("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"));
|
("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"));
|
||||||
scriptPubKeyBytes.write(Script.OP_CHECKSIG);
|
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) {
|
} catch (Exception e) {
|
||||||
// Cannot happen.
|
// Cannot happen.
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -152,7 +152,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||||||
this.inputs = new ArrayList<TransactionInput>(tx.getInputs());
|
this.inputs = new ArrayList<TransactionInput>(tx.getInputs());
|
||||||
this.outputs = new ArrayList<TransactionOutput>(tx.getOutputs().size());
|
this.outputs = new ArrayList<TransactionOutput>(tx.getOutputs().size());
|
||||||
for (StoredTransactionOutput output : tx.getOutputs()) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,17 +111,6 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
|||||||
length = 8 + VarInt.sizeOf(scriptBytes.length) + scriptBytes.length;
|
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 {
|
public Script getScriptPubKey() throws ScriptException {
|
||||||
if (scriptPubKey == null) {
|
if (scriptPubKey == null) {
|
||||||
maybeParse();
|
maybeParse();
|
||||||
|
Loading…
Reference in New Issue
Block a user