Package org.bitcoinj.core
Class GetBlocksMessage
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.GetBlocksMessage
-
- 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
.Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockLocator
locator
protected Sha256Hash
stopHash
protected long
version
-
Fields inherited from class org.bitcoinj.core.Message
MAX_SIZE, params, payload, serializer
-
-
Constructor Summary
Constructors Constructor Description GetBlocksMessage(NetworkParameters params, java.nio.ByteBuffer payload)
GetBlocksMessage(NetworkParameters params, BlockLocator locator, Sha256Hash stopHash)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.boolean
equals(java.lang.Object o)
BlockLocator
getLocator()
Sha256Hash
getStopHash()
int
hashCode()
protected void
parse()
java.lang.String
toString()
-
Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, getHash, getMessageSize, getParams, readByte, readByteArray, readBytes, readHash, readInt32, readInt64, readStr, readUint32, readUint64, readVarInt, skipBytes, unCache, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
version
protected long version
-
locator
protected BlockLocator locator
-
stopHash
protected Sha256Hash stopHash
-
-
Constructor Detail
-
GetBlocksMessage
public GetBlocksMessage(NetworkParameters params, BlockLocator locator, Sha256Hash stopHash)
-
GetBlocksMessage
public GetBlocksMessage(NetworkParameters params, java.nio.ByteBuffer payload) throws ProtocolException
- Throws:
ProtocolException
-
-
Method Detail
-
parse
protected void parse() throws java.nio.BufferUnderflowException, ProtocolException
- Specified by:
parse
in classMessage
- Throws:
java.nio.BufferUnderflowException
ProtocolException
-
getLocator
public BlockLocator getLocator()
-
getStopHash
public Sha256Hash getStopHash()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
bitcoinSerializeToStream
protected void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-