Package org.bitcoinj.core
Class TransactionOutPoint
java.lang.Object
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
Modifier and TypeFieldDescriptionstatic final int
static final TransactionOutPoint
Special outpoint that normally marks a coinbase input. -
Constructor Summary
ConstructorDescriptionTransactionOutPoint
(long index, Sha256Hash hash) TransactionOutPoint
(long index, Transaction fromTx) TransactionOutPoint
(TransactionOutput connectedOutput) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Deprecated.connectTransaction
(Transaction transaction) Returns a copy of this outpoint, but with the provided transaction as fromTx.Returns a copy of this outpoint, but with the connectedOutput removed.Returns a copy of this outpoint, but with fromTx removed.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()
Deprecated.Usehash()
long
getIndex()
Deprecated.Useindex()
int
Deprecated.useBYTES
hash()
Returns the hash of the transaction this outpoint references/spends/is connected to.int
hashCode()
long
index()
static TransactionOutPoint
read
(ByteBuffer payload) Deserialize this transaction outpoint from a given payload.byte[]
Allocates a byte array and writes this transaction outpoint into it.toString()
write
(ByteBuffer buf) Write this transaction outpoint into the given buffer.
-
Field Details
-
BYTES
public static final int BYTES- See Also:
-
UNCONNECTED
Special outpoint that normally marks a coinbase input. It's also used as a test dummy.
-
-
Constructor Details
-
TransactionOutPoint
-
TransactionOutPoint
-
TransactionOutPoint
-
-
Method Details
-
read
public static TransactionOutPoint read(ByteBuffer payload) throws BufferUnderflowException, ProtocolException Deserialize this transaction outpoint from a given payload.- Parameters:
payload
- payload to deserialize from- Returns:
- read transaction outpoint
- Throws:
BufferUnderflowException
- if the read message extends beyond the remaining bytes of the payloadProtocolException
-
write
Write this transaction outpoint into the given buffer.- Parameters:
buf
- buffer to write into- Returns:
- the buffer
- Throws:
BufferOverflowException
- if the outpoint doesn't fit the remaining buffer
-
serialize
public byte[] serialize()Allocates a byte array and writes this transaction outpoint into it.- Returns:
- byte array containing the transaction outpoint
-
bitcoinSerialize
Deprecated.useserialize()
-
getMessageSize
Deprecated.useBYTES
-
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
-
disconnectOutput
Returns a copy of this outpoint, but with the connectedOutput removed.- Returns:
- outpoint with removed connectedOutput
-
connectTransaction
Returns a copy of this outpoint, but with the provided transaction as fromTx.- Parameters:
transaction
- transaction to set as fromTx- Returns:
- outpoint with fromTx set
-
disconnectTransaction
Returns a copy of this outpoint, but with fromTx removed.- Returns:
- outpoint with removed fromTx
-
toString
-
hash
Returns the hash of the transaction this outpoint references/spends/is connected to. -
index
public long index()- Returns:
- the index of this outpoint
-
getHash
Deprecated.Usehash()
-
getIndex
Deprecated.Useindex()
-
equals
-
hashCode
public int hashCode()
-
serialize()