com.google.bitcoin.core
Class GetHeadersMessage

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.GetBlocksMessage
          extended by com.google.bitcoin.core.GetHeadersMessage
All Implemented Interfaces:
Serializable

public class GetHeadersMessage
extends GetBlocksMessage

The "getheaders" command is structurally identical to "getblocks", but has different meaning. On receiving this message a Bitcoin node returns matching blocks up to the limit, but without the bodies. It is useful as an optimization: when your wallet does not contain any keys created before a particular time, you don't have to download the bodies for those blocks because you know there are no relevant transactions.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.bitcoin.core.Message
Message.LazyParseException
 
Field Summary
 
Fields inherited from class com.google.bitcoin.core.GetBlocksMessage
locator, stopHash, version
 
Fields inherited from class com.google.bitcoin.core.Message
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH
 
Constructor Summary
GetHeadersMessage(NetworkParameters params, byte[] msg)
           
GetHeadersMessage(NetworkParameters params, List<Sha256Hash> locator, Sha256Hash stopHash)
           
 
Method Summary
 boolean equals(Object o)
          Compares two getheaders messages.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class com.google.bitcoin.core.GetBlocksMessage
bitcoinSerializeToStream, getLocator, getStopHash, parse, parseLite
 
Methods inherited from class com.google.bitcoin.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GetHeadersMessage

public GetHeadersMessage(NetworkParameters params,
                         List<Sha256Hash> locator,
                         Sha256Hash stopHash)

GetHeadersMessage

public GetHeadersMessage(NetworkParameters params,
                         byte[] msg)
                  throws ProtocolException
Throws:
ProtocolException
Method Detail

toString

public String toString()
Overrides:
toString in class GetBlocksMessage

equals

public boolean equals(Object o)
Compares two getheaders messages. Note that even though they are structurally identical a GetHeadersMessage will not compare equal to a GetBlocksMessage containing the same data.

Overrides:
equals in class GetBlocksMessage

hashCode

public int hashCode()
Overrides:
hashCode in class GetBlocksMessage


Copyright © 2014. All rights reserved.