Package org.bitcoinj.core
Class InventoryMessage
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.ListMessage
org.bitcoinj.core.InventoryMessage
- Direct Known Subclasses:
- NotFoundMessage
Represents the "inv" P2P network message. An inv contains a list of hashes of either blocks or transactions. It's
 a bandwidth optimization - on receiving some data, a (fully validating) peer sends every connected peer an inv
 containing the hash of what it saw. It'll only transmit the full thing if a peer asks for it with a
 GetDataMessage.
Instances of this class are not safe for use by multiple threads.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intA hard coded constant in the protocol.Fields inherited from class org.bitcoinj.core.ListMessageitems, MAX_INVENTORY_ITEMSFields inherited from class org.bitcoinj.core.Messagecursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
- 
Constructor SummaryConstructorsConstructorDescriptionInventoryMessage(NetworkParameters params) InventoryMessage(NetworkParameters params, byte[] bytes) InventoryMessage(NetworkParameters params, byte[] payload, MessageSerializer serializer, int length) Deserializes an 'inv' message.
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoidstatic InventoryMessagewith(Transaction... txns) Creates a new inv message for the given transactions.Methods inherited from class org.bitcoinj.core.ListMessageaddItem, bitcoinSerializeToStream, equals, getItems, hashCode, parse, removeItem, toStringMethods inherited from class org.bitcoinj.core.MessageadjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
- 
Field Details- 
MAX_INV_SIZEpublic static final int MAX_INV_SIZEA hard coded constant in the protocol.- See Also:
 
 
- 
- 
Constructor Details- 
InventoryMessage- Throws:
- ProtocolException
 
- 
InventoryMessagepublic InventoryMessage(NetworkParameters params, byte[] payload, MessageSerializer serializer, int length) throws ProtocolException Deserializes an 'inv' message.- Parameters:
- params- NetworkParameters object.
- payload- Bitcoin protocol formatted byte array containing message content.
- serializer- the serializer to use for this message.
- length- The length of message if known. Usually this is provided when deserializing of the wire as the length will be provided as part of the header. If unknown then set to Message.UNKNOWN_LENGTH
- Throws:
- ProtocolException
 
- 
InventoryMessage
 
- 
- 
Method Details- 
addBlock
- 
addTransaction
- 
withCreates a new inv message for the given transactions.
 
-