Package org.bitcoinj.core
Class TransactionOutPoint
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.ChildMessage
org.bitcoinj.core.TransactionOutPoint
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
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
Constructor Summary
ConstructorDescriptionTransactionOutPoint
(NetworkParameters params, byte[] payload, int offset) /** Deserializes the message.TransactionOutPoint
(NetworkParameters params, byte[] payload, int offset, Message parent, MessageSerializer serializer) Deserializes the message.TransactionOutPoint
(NetworkParameters params, long index, Sha256Hash hash) TransactionOutPoint
(NetworkParameters params, long index, Transaction fromTx) TransactionOutPoint
(NetworkParameters params, TransactionOutput connectedOutput) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.boolean
getConnectedKey
(KeyBag keyBag) Returns the ECKey identified in the connected output, for either P2PKH, P2WPKH or P2PK scripts.An outpoint is a part of a transaction input that points to the output of another transaction.byte[]
Returns the pubkey script from the connected output.getConnectedRedeemData
(KeyBag keyBag) Returns the RedeemData identified in the connected output, for either P2PKH, P2WPKH, P2PK or P2SH scripts.getHash()
Returns the hash of the transaction this outpoint references/spends/is connected to.long
getIndex()
int
hashCode()
protected void
parse()
void
setIndex
(long index) toString()
Methods inherited from class org.bitcoinj.core.ChildMessage
adjustLength, adjustLength, setParent, unCache
Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, bitcoinSerialize, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unsafeBitcoinSerialize
-
Constructor Details
-
TransactionOutPoint
-
TransactionOutPoint
-
TransactionOutPoint
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, byte[] payload, int offset) throws ProtocolException /** Deserializes the message. This is usually part of a transaction message.- Throws:
ProtocolException
-
TransactionOutPoint
public TransactionOutPoint(NetworkParameters params, byte[] payload, int offset, Message parent, MessageSerializer serializer) throws ProtocolException Deserializes the message. This is usually part of a transaction message.- Parameters:
params
- NetworkParameters object.offset
- The location of the first payload byte within the array.serializer
- the serializer to use for this message.- Throws:
ProtocolException
-
-
Method Details
-
parse
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
bitcoinSerializeToStream
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:
IOException
-
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:
NullPointerException
- if there is no connected output.
-
getConnectedKey
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
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
-
getHash
Returns the hash of the transaction this outpoint references/spends/is connected to. -
getIndex
public long getIndex() -
setIndex
public void setIndex(long index) -
equals
-
hashCode
public int hashCode()
-