public class HeadersMessage extends Message
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.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_HEADERS |
cursor, length, MAX_SIZE, offset, params, payload, protocolVersion, recached, serializer, UNKNOWN_LENGTH
Constructor and Description |
---|
HeadersMessage(NetworkParameters params,
Block... headers) |
HeadersMessage(NetworkParameters params,
byte[] payload) |
HeadersMessage(NetworkParameters params,
java.util.List<Block> headers) |
Modifier and Type | Method and Description |
---|---|
void |
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.
|
java.util.List<Block> |
getBlockHeaders() |
protected void |
parse() |
adjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, unCache, unsafeBitcoinSerialize
public static final int MAX_HEADERS
public HeadersMessage(NetworkParameters params, byte[] payload) throws ProtocolException
ProtocolException
public HeadersMessage(NetworkParameters params, Block... headers) throws ProtocolException
ProtocolException
public HeadersMessage(NetworkParameters params, java.util.List<Block> headers) throws ProtocolException
ProtocolException
public void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Message
bitcoinSerializeToStream
in class Message
java.io.IOException
protected void parse() throws ProtocolException
parse
in class Message
ProtocolException
public java.util.List<Block> getBlockHeaders()