Package org.bitcoinj.core
Class GetBlocksMessage
- java.lang.Object
-
- org.bitcoinj.core.BaseMessage
-
- org.bitcoinj.core.GetBlocksMessage
-
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
GetHeadersMessage
public class GetBlocksMessage extends BaseMessage
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.Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockLocatorlocatorprotected Sha256HashstopHashprotected longversion
-
Constructor Summary
Constructors Constructor Description GetBlocksMessage(long protocolVersion, BlockLocator locator, Sha256Hash stopHash)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbitcoinSerializeToStream(java.io.OutputStream stream)Serializes this message to the provided stream.booleanequals(java.lang.Object o)BlockLocatorgetLocator()Sha256HashgetStopHash()inthashCode()static GetBlocksMessageread(java.nio.ByteBuffer payload)Deserialize this message from a given payload.java.lang.StringtoString()-
Methods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serialize
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
version
protected long version
-
locator
protected BlockLocator locator
-
stopHash
protected Sha256Hash stopHash
-
-
Constructor Detail
-
GetBlocksMessage
public GetBlocksMessage(long protocolVersion, BlockLocator locator, Sha256Hash stopHash)
-
-
Method Detail
-
read
public static GetBlocksMessage read(java.nio.ByteBuffer payload) throws java.nio.BufferUnderflowException, ProtocolException
Deserialize this message from a given payload.- Parameters:
payload- payload to deserialize from- Returns:
- read message
- Throws:
java.nio.BufferUnderflowException- if the read message extends beyond the remaining bytes of the payloadProtocolException
-
getLocator
public BlockLocator getLocator()
-
getStopHash
public Sha256Hash getStopHash()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
bitcoinSerializeToStream
protected void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from class:BaseMessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Specified by:
bitcoinSerializeToStreamin classBaseMessage- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-