com.google.bitcoin.core
Class GetBlocksMessage
java.lang.Object
com.google.bitcoin.core.Message
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
| Fields inherited from class com.google.bitcoin.core.Message |
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH |
| Methods inherited from class com.google.bitcoin.core.Message |
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize |
version
protected long version
locator
protected List<Sha256Hash> locator
stopHash
protected Sha256Hash stopHash
GetBlocksMessage
public GetBlocksMessage(NetworkParameters params,
List<Sha256Hash> locator,
Sha256Hash stopHash)
GetBlocksMessage
public GetBlocksMessage(NetworkParameters params,
byte[] msg)
throws ProtocolException
- Throws:
ProtocolException
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.