com.google.bitcoin.core
Class GetBlocksMessage

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.GetBlocksMessage
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GetHeadersMessage

public class GetBlocksMessage
extends Message

Represents the "getblocks" P2P network message, which requests the hashes of the parts of the block chain we're missing. Those blocks can then be downloaded with a GetDataMessage.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.bitcoin.core.Message
Message.LazyParseException
 
Field Summary
protected  List<Sha256Hash> locator
           
protected  Sha256Hash stopHash
           
protected  long version
           
 
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
GetBlocksMessage(NetworkParameters params, byte[] msg)
           
GetBlocksMessage(NetworkParameters params, List<Sha256Hash> locator, Sha256Hash stopHash)
           
 
Method Summary
protected  void bitcoinSerializeToStream(OutputStream stream)
          Serializes this message to the provided stream.
 boolean equals(Object o)
           
 List<Sha256Hash> getLocator()
           
 Sha256Hash getStopHash()
           
 int hashCode()
           
 void parse()
           
protected  void parseLite()
          Perform the most minimal parse possible to calculate the length of the message.
 String toString()
           
 
Methods inherited from class com.google.bitcoin.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

version

protected long version

locator

protected List<Sha256Hash> locator

stopHash

protected Sha256Hash stopHash
Constructor Detail

GetBlocksMessage

public GetBlocksMessage(NetworkParameters params,
                        List<Sha256Hash> locator,
                        Sha256Hash stopHash)

GetBlocksMessage

public GetBlocksMessage(NetworkParameters params,
                        byte[] msg)
                 throws ProtocolException
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

parse

public void parse()
           throws ProtocolException
Throws:
ProtocolException

getLocator

public List<Sha256Hash> getLocator()

getStopHash

public Sha256Hash getStopHash()

toString

public String toString()
Overrides:
toString in class Object

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

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2014. All rights reserved.