Package org.bitcoinj.core
Class GetHeadersMessage
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.GetBlocksMessage
org.bitcoinj.core.GetHeadersMessage
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.
Instances of this class are not safe for use by multiple threads.
-
Field Summary
Fields inherited from class org.bitcoinj.core.GetBlocksMessage
locator, stopHash, version
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
Constructor Summary
ConstructorDescriptionGetHeadersMessage
(NetworkParameters params, byte[] payload) GetHeadersMessage
(NetworkParameters params, BlockLocator locator, Sha256Hash stopHash) -
Method Summary
Methods inherited from class org.bitcoinj.core.GetBlocksMessage
bitcoinSerializeToStream, getLocator, getStopHash, 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
-
Constructor Details
-
GetHeadersMessage
-
GetHeadersMessage
- Throws:
ProtocolException
-
-
Method Details
-
toString
- Overrides:
toString
in classGetBlocksMessage
-
equals
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 classGetBlocksMessage
-
hashCode
public int hashCode()- Overrides:
hashCode
in classGetBlocksMessage
-