com.google.bitcoin.core
Class TransactionOutPoint

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.ChildMessage
          extended by com.google.bitcoin.core.TransactionOutPoint
All Implemented Interfaces:
Serializable

public class TransactionOutPoint
extends ChildMessage
implements Serializable

This message is a reference or pointer to an output of a different transaction.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.bitcoin.core.Message
Message.LazyParseException
 
Field Summary
 
Fields inherited from class com.google.bitcoin.core.Message
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH
 
Constructor Summary
TransactionOutPoint(NetworkParameters params, byte[] payload, int offset)
          /** Deserializes the message.
TransactionOutPoint(NetworkParameters params, byte[] payload, int offset, Message parent, boolean parseLazy, boolean parseRetain)
          Deserializes the message.
TransactionOutPoint(NetworkParameters params, long index, Sha256Hash hash)
           
TransactionOutPoint(NetworkParameters params, long index, Transaction fromTx)
           
 
Method Summary
protected  void bitcoinSerializeToStream(OutputStream stream)
          Serializes this message to the provided stream.
 boolean equals(Object other)
           
 ECKey getConnectedKey(Wallet wallet)
          Returns the ECKey identified in the connected output, for either pay-to-address scripts or pay-to-key scripts.
 TransactionOutput getConnectedOutput()
          An outpoint is a part of a transaction input that points to the output of another transaction.
 Sha256Hash getHash()
          Returns the hash of the transaction this outpoint references/spends/is connected to.
 long getIndex()
           
 int getMessageSize()
          This should be overridden to extract correct message size in the case of lazy parsing.
 int hashCode()
           
protected  void parseLite()
          Perform the most minimal parse possible to calculate the length of the message.
 void setIndex(long index)
           
 String toString()
           
 
Methods inherited from class com.google.bitcoin.core.ChildMessage
adjustLength, adjustLength, setParent, unCache
 
Methods inherited from class com.google.bitcoin.core.Message
bitcoinSerialize, bitcoinSerialize, ensureParsed, getParams, isCached, isParsed, isRecached, maybeParse, unsafeBitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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,
                           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,
                           boolean parseLazy,
                           boolean parseRetain)
                    throws ProtocolException
Deserializes the message. This is usually part of a transaction message.

Parameters:
params - NetworkParameters object.
offset - The location of the first msg byte within the array.
parseLazy - Whether to perform a full parse immediately or delay until a read is requested.
parseRetain - Whether to retain the backing byte array for quick reserialization. If true and the backing byte array is invalidated due to modification of a field then the cached bytes may be repopulated and retained if the message is serialized again in the future.
Throws:
ProtocolException
Method Detail

parseLite

protected void parseLite()
                  throws ProtocolException
Description copied from class: Message
Perform the most minimal parse possible to calculate the length of the message. This is only required for subclasses of ChildClass as root level messages will have their length passed into the constructor.

Implementations should adhere to the following contract: If parseLazy = true the 'length' field must be set before returning. If parseLazy = false the length field must be set either within the parseLite() method OR the parse() method. The overriding requirement is that length must be set to non UNKNOWN_MESSAGE value by the time the constructor exits.

Specified by:
parseLite in class Message
Throws:
ProtocolException

getMessageSize

public int getMessageSize()
Description copied from class: Message
This should be overridden to extract correct message size in the case of lazy parsing. Until this method is implemented in a subclass of ChildMessage lazy parsing may have no effect. This default implementation is a safe fall back that will ensure it returns a correct value by parsing the message.

Overrides:
getMessageSize in class Message

bitcoinSerializeToStream

protected void bitcoinSerializeToStream(OutputStream stream)
                                 throws IOException
Description copied from class: Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().

Throws:
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.


getConnectedKey

@Nullable
public ECKey getConnectedKey(Wallet wallet)
                      throws ScriptException
Returns the ECKey identified in the connected output, for either pay-to-address scripts or pay-to-key scripts. If the script forms cannot be understood, throws ScriptException.

Returns:
an ECKey or null if the connected key cannot be found in the wallet.
Throws:
ScriptException

toString

public String toString()
Overrides:
toString in class Object

getHash

public Sha256Hash getHash()
Returns the hash of the transaction this outpoint references/spends/is connected to.

Overrides:
getHash in class Message

getIndex

public long getIndex()

setIndex

public void setIndex(long index)

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2014. All rights reserved.