Package org.bitcoinj.core
Class HeadersMessage
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.HeadersMessage
A protocol message that contains a repeated series of block headers, sent in response to the "getheaders" command. This is useful when you want to traverse the chain but know you don't care about the block contents, for example, because you have a freshly created wallet with no keys.
Instances of this class are not safe for use by multiple threads.
-
Field Summary
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
Constructor Summary
ConstructorDescriptionHeadersMessage
(NetworkParameters params, byte[] payload) HeadersMessage
(NetworkParameters params, List<Block> headers) HeadersMessage
(NetworkParameters params, Block... headers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.protected void
parse()
Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
Field Details
-
MAX_HEADERS
public static final int MAX_HEADERS- See Also:
-
-
Constructor Details
-
HeadersMessage
- Throws:
ProtocolException
-
HeadersMessage
- Throws:
ProtocolException
-
HeadersMessage
- Throws:
ProtocolException
-
-
Method Details
-
bitcoinSerializeToStream
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:
IOException
-
parse
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
getBlockHeaders
-