nxt.peer

## Class NetworkMessage.BlockInventoryMessage

- java.lang.Object
- - nxt.peer.NetworkMessage
  - - nxt.peer.NetworkMessage.BlockInventoryMessage

- Enclosing class:
    NetworkMessage

      public static class NetworkMessage.BlockInventoryMessage
      extends NetworkMessage

  The BlockInventory message is sent when a peer has received a new block. The peer responds with a GetBlock request if it wants to get the block.
  - Block identifier (long)
  - Previous block identifier (long)
  - Block timestamp (integer)
  - Transaction identifier list (ChainTransactionId)
  The ordering of transactions in the transaction identifier list must be same as the one used by BlockBytes when returning block and transaction bytes, as the exclude transactions feature depends on this.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class nxt.peer.NetworkMessage

      `NetworkMessage.AddPeersMessage, NetworkMessage.BlockchainStateMessage, NetworkMessage.BlockIdsMessage, NetworkMessage.BlockInventoryMessage, NetworkMessage.BlocksMessage, NetworkMessage.BundlerRateMessage, NetworkMessage.CumulativeDifficultyMessage, NetworkMessage.ErrorMessage, NetworkMessage.GetBlockMessage, NetworkMessage.GetCumulativeDifficultyMessage, NetworkMessage.GetInfoMessage, NetworkMessage.GetMilestoneBlockIdsMessage, NetworkMessage.GetNextBlockIdsMessage, NetworkMessage.GetNextBlocksMessage, NetworkMessage.GetPeersMessage, NetworkMessage.GetTransactionsMessage, NetworkMessage.GetUnconfirmedTransactionsMessage, NetworkMessage.MilestoneBlockIdsMessage, NetworkMessage.TransactionsInventoryMessage, NetworkMessage.TransactionsMessage`

  - ### Field Summary

    - ### Fields inherited from class nxt.peer.NetworkMessage

      `MAX_ARRAY_LENGTH, MAX_LIST_SIZE, messageId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockInventoryMessage(Block block)` Construct a BlockInventory message

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected NetworkMessage` | `constructMessage(java.nio.ByteBuffer bytes)` Construct the message from the message bytes
    `long` | `getBlockId()` Get the block identifier
    `long` | `getPreviousBlockId()` Get the previous block identifier
    `int` | `getTimestamp()` Get the timestamp
    `java.util.List<ChainTransactionId>` | `getTransactionIds()` Get the block transaction identifiers

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BlockInventoryMessage

          public BlockInventoryMessage(Block block)

      Construct a BlockInventory message
      Parameters:
        `block` - Block

  - ### Method Detail

    - #### constructMessage

          protected NetworkMessage constructMessage(java.nio.ByteBuffer bytes)
                                             throws java.nio.BufferOverflowException,
                                                    java.nio.BufferUnderflowException,
                                                    nxt.peer.NetworkException

      Construct the message from the message bytes
      Overrides:
        `constructMessage` in class `NetworkMessage`
      Parameters:
        `bytes` - Message bytes following the message name
      Returns:
        Message
      Throws:
        `java.nio.BufferOverflowException` - Message buffer is too small
        `java.nio.BufferUnderflowException` - Message is too short
        `NetworkException` - Message is not valid

    - #### getBlockId

          public long getBlockId()

      Get the block identifier
      Returns:
        Block identifier

    - #### getPreviousBlockId

          public long getPreviousBlockId()

      Get the previous block identifier
      Returns:
        Block identifier

    - #### getTimestamp

          public int getTimestamp()

      Get the timestamp
      Returns:
        Timestamp

    - #### getTransactionIds

          public java.util.List<ChainTransactionId> getTransactionIds()

      Get the block transaction identifiers
      Returns:
        Transaction identifiers