mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 17:26:28 +01:00
TransactionInput: remove serializer
from constructor
This commit is contained in:
parent
8091384ff6
commit
c1a32f6585
2 changed files with 5 additions and 16 deletions
|
@ -694,7 +694,7 @@ public class Transaction extends Message {
|
||||||
int numInputs = numInputsVarInt.intValue();
|
int numInputs = numInputsVarInt.intValue();
|
||||||
inputs = new ArrayList<>(Math.min((int) numInputs, Utils.MAX_INITIAL_ARRAY_LENGTH));
|
inputs = new ArrayList<>(Math.min((int) numInputs, Utils.MAX_INITIAL_ARRAY_LENGTH));
|
||||||
for (long i = 0; i < numInputs; i++) {
|
for (long i = 0; i < numInputs; i++) {
|
||||||
TransactionInput input = new TransactionInput(params, this, payload.slice(), serializer);
|
TransactionInput input = new TransactionInput(params, this, payload.slice());
|
||||||
inputs.add(input);
|
inputs.add(input);
|
||||||
// intentionally read again, due to the slice above
|
// intentionally read again, due to the slice above
|
||||||
Buffers.skipBytes(payload, TransactionOutPoint.MESSAGE_LENGTH);
|
Buffers.skipBytes(payload, TransactionOutPoint.MESSAGE_LENGTH);
|
||||||
|
@ -709,7 +709,7 @@ public class Transaction extends Message {
|
||||||
int numOutputs = numOutputsVarInt.intValue();
|
int numOutputs = numOutputsVarInt.intValue();
|
||||||
outputs = new ArrayList<>(Math.min((int) numOutputs, Utils.MAX_INITIAL_ARRAY_LENGTH));
|
outputs = new ArrayList<>(Math.min((int) numOutputs, Utils.MAX_INITIAL_ARRAY_LENGTH));
|
||||||
for (long i = 0; i < numOutputs; i++) {
|
for (long i = 0; i < numOutputs; i++) {
|
||||||
TransactionOutput output = new TransactionOutput(params, this, payload.slice(), serializer);
|
TransactionOutput output = new TransactionOutput(params, this, payload.slice());
|
||||||
outputs.add(output);
|
outputs.add(output);
|
||||||
// intentionally read again, due to the slice above
|
// intentionally read again, due to the slice above
|
||||||
Buffers.skipBytes(payload, 8); // value
|
Buffers.skipBytes(payload, 8); // value
|
||||||
|
|
|
@ -131,6 +131,9 @@ public class TransactionInput extends Message {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserializes an input message. This is usually part of a transaction message.
|
* Deserializes an input message. This is usually part of a transaction message.
|
||||||
|
* @param params NetworkParameters object.
|
||||||
|
* @param payload Bitcoin protocol formatted byte array containing message content.
|
||||||
|
* @throws ProtocolException
|
||||||
*/
|
*/
|
||||||
public TransactionInput(NetworkParameters params, @Nullable Transaction parentTransaction, ByteBuffer payload) throws ProtocolException {
|
public TransactionInput(NetworkParameters params, @Nullable Transaction parentTransaction, ByteBuffer payload) throws ProtocolException {
|
||||||
super(params, payload);
|
super(params, payload);
|
||||||
|
@ -138,20 +141,6 @@ public class TransactionInput extends Message {
|
||||||
this.value = null;
|
this.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes an input message. This is usually part of a transaction message.
|
|
||||||
* @param params NetworkParameters object.
|
|
||||||
* @param payload Bitcoin protocol formatted byte array containing message content.
|
|
||||||
* @param serializer the serializer to use for this message.
|
|
||||||
* @throws ProtocolException
|
|
||||||
*/
|
|
||||||
public TransactionInput(NetworkParameters params, Transaction parentTransaction, ByteBuffer payload, MessageSerializer serializer)
|
|
||||||
throws ProtocolException {
|
|
||||||
super(params, payload, serializer);
|
|
||||||
setParent(parentTransaction);
|
|
||||||
this.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index of this input in the parent transaction, or throws if this input is freestanding. Iterates
|
* Gets the index of this input in the parent transaction, or throws if this input is freestanding. Iterates
|
||||||
* over the parents list to discover this.
|
* over the parents list to discover this.
|
||||||
|
|
Loading…
Add table
Reference in a new issue