Class HeadersMessage

  • All Implemented Interfaces:
    Message

    public class HeadersMessage
    extends BaseMessage

    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.

    • Method Detail

      • read

        public static HeadersMessage 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 payload
        ProtocolException
      • bitcoinSerializeToStream

        public void bitcoinSerializeToStream​(java.io.OutputStream stream)
                                      throws java.io.IOException
        Description copied from class: BaseMessage
        Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().
        Specified by:
        bitcoinSerializeToStream in class BaseMessage
        Throws:
        java.io.IOException
      • getBlockHeaders

        public java.util.List<Block> getBlockHeaders()