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
FieldsFields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionHeadersMessage(NetworkParameters params, byte[] payload) HeadersMessage(NetworkParameters params, List<Block> headers) HeadersMessage(NetworkParameters params, Block... headers) -
Method Summary
Modifier and TypeMethodDescriptionvoidbitcoinSerializeToStream(OutputStream stream) Serializes this message to the provided stream.protected voidparse()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:MessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStreamin classMessage- Throws:
IOException
-
parse
- Specified by:
parsein classMessage- Throws:
ProtocolException
-
getBlockHeaders
-