Package org.bitcoinj.core
Class TransactionOutPoint
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.ChildMessage
-
- org.bitcoinj.core.TransactionOutPoint
-
public class TransactionOutPoint extends ChildMessage
This message is a reference or pointer to an output of a different transaction.
Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
-
Fields inherited from class org.bitcoinj.core.ChildMessage
parent
-
Fields inherited from class org.bitcoinj.core.Message
MAX_SIZE, params, payload, serializer
-
-
Constructor Summary
Constructors Constructor Description TransactionOutPoint(NetworkParameters params, long index, Sha256Hash hash)
TransactionOutPoint(NetworkParameters params, long index, Transaction fromTx)
TransactionOutPoint(NetworkParameters params, java.nio.ByteBuffer payload)
/** Deserializes the message.TransactionOutPoint(NetworkParameters params, java.nio.ByteBuffer payload, Message parent, MessageSerializer serializer)
Deserializes the message.TransactionOutPoint(NetworkParameters params, TransactionOutput connectedOutput)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.boolean
equals(java.lang.Object o)
ECKey
getConnectedKey(KeyBag keyBag)
Returns the ECKey identified in the connected output, for either P2PKH, P2WPKH or P2PK scripts.TransactionOutput
getConnectedOutput()
An outpoint is a part of a transaction input that points to the output of another transaction.byte[]
getConnectedPubKeyScript()
Returns the pubkey script from the connected output.RedeemData
getConnectedRedeemData(KeyBag keyBag)
Returns the RedeemData identified in the connected output, for either P2PKH, P2WPKH, P2PK or P2SH scripts.Sha256Hash
getHash()
Returns the hash of the transaction this outpoint references/spends/is connected to.long
getIndex()
int
getMessageSize()
Return the size of the serialized message.int
hashCode()
protected void
parse()
void
setIndex(long index)
Deprecated.Don't mutate this class -- create a new instance instead.java.lang.String
toString()
-
Methods inherited from class org.bitcoinj.core.ChildMessage
setParent, unCache
-
Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, getParams, readByte, readByteArray, readBytes, readHash, readInt32, readInt64, readStr, readUint32, readUint64, readVarInt, skipBytes, unsafeBitcoinSerialize
-
-
-
-
Constructor Detail
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, long index, @Nullable Transaction fromTx)
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, long index, Sha256Hash hash)
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, TransactionOutput connectedOutput)
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, java.nio.ByteBuffer payload) throws ProtocolException
/** Deserializes the message. This is usually part of a transaction message.- Throws:
ProtocolException
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, java.nio.ByteBuffer payload, Message parent, MessageSerializer serializer) throws ProtocolException
Deserializes the message. This is usually part of a transaction message.- Parameters:
params
- NetworkParameters object.serializer
- the serializer to use for this message.- Throws:
ProtocolException
-
-
Method Detail
-
parse
protected void parse() throws java.nio.BufferUnderflowException, ProtocolException
- Specified by:
parse
in classMessage
- Throws:
java.nio.BufferUnderflowException
ProtocolException
-
getMessageSize
public int getMessageSize()
Description copied from class:Message
Return the size of the serialized message. Note that if the message was deserialized from a payload, this size can differ from the size of the original payload.- Overrides:
getMessageSize
in classMessage
- Returns:
- size of the serialized message in bytes
-
bitcoinSerializeToStream
protected void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
getConnectedOutput
@Nullable public TransactionOutput getConnectedOutput()
An outpoint is a part of a transaction input that points to the output of another transaction. If we have both sides in memory, and they have been linked together, this returns a pointer to the connected output, or null if there is no such connection.
-
getConnectedPubKeyScript
public byte[] getConnectedPubKeyScript()
Returns the pubkey script from the connected output.- Throws:
java.lang.NullPointerException
- if there is no connected output.
-
getConnectedKey
@Nullable public ECKey getConnectedKey(KeyBag keyBag) throws ScriptException
Returns the ECKey identified in the connected output, for either P2PKH, P2WPKH or P2PK scripts. For P2SH scripts you can usegetConnectedRedeemData(KeyBag)
and then get the key from RedeemData. If the script form cannot be understood, throws ScriptException.- Returns:
- an ECKey or null if the connected key cannot be found in the wallet.
- Throws:
ScriptException
-
getConnectedRedeemData
@Nullable public RedeemData getConnectedRedeemData(KeyBag keyBag) throws ScriptException
Returns the RedeemData identified in the connected output, for either P2PKH, P2WPKH, P2PK or P2SH scripts. If the script forms cannot be understood, throws ScriptException.- Returns:
- a RedeemData or null if the connected data cannot be found in the wallet.
- Throws:
ScriptException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getHash
public Sha256Hash getHash()
Returns the hash of the transaction this outpoint references/spends/is connected to.
-
getIndex
public long getIndex()
-
setIndex
@Deprecated public void setIndex(long index)
Deprecated.Don't mutate this class -- create a new instance instead.- Parameters:
index
- new index
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-