Package org.bitcoinj.core
Class InventoryMessage
java.lang.Object
org.bitcoinj.core.BaseMessage
org.bitcoinj.core.ListMessage
org.bitcoinj.core.InventoryMessage
- All Implemented Interfaces:
Message
- 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 -- that use deprecated methods -- are not safe for use by multiple threads.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
A hard coded constant in the protocol.Fields inherited from class org.bitcoinj.core.ListMessage
items, MAX_INVENTORY_ITEMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
Deprecated.protected
InventoryMessage
(List<InventoryItem> items) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Use a constructor or factoringvoid
Deprecated.Use a constructor or factoringstatic InventoryMessage
static InventoryMessage
static InventoryMessage
ofTransactions
(List<Transaction> transactions) static InventoryMessage
ofTransactions
(Transaction... transactions) static InventoryMessage
read
(ByteBuffer payload) Deserialize this message from a given payload.static InventoryMessage
with
(Transaction... txns) Deprecated.Methods inherited from class org.bitcoinj.core.ListMessage
addItem, bitcoinSerializeToStream, equals, getItems, hashCode, readItems, removeItem, toString
Methods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serialize
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
Field Details
-
MAX_INV_SIZE
public static final int MAX_INV_SIZEA hard coded constant in the protocol.- See Also:
-
-
Constructor Details
-
InventoryMessage
Deprecated. -
InventoryMessage
-
-
Method Details
-
read
public static InventoryMessage read(ByteBuffer payload) throws BufferUnderflowException, ProtocolException Deserialize this message from a given payload.- Parameters:
payload
- payload to deserialize from- Returns:
- read message
- Throws:
BufferUnderflowException
- if the read message extends beyond the remaining bytes of the payloadProtocolException
-
ofBlocks
-
ofBlocks
-
ofTransactions
-
ofTransactions
-
addBlock
Deprecated.Use a constructor or factoring -
addTransaction
Deprecated.Use a constructor or factoring -
with
Deprecated.Creates a new inv message for the given transactions.
-