public static class NetworkMessage.BlocksMessage extends 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.TransactionsMessageMAX_ARRAY_LENGTH, MAX_LIST_SIZE, MAX_LIST_SIZE_PRE_2_3_3, messageId| Constructor and Description |
|---|
BlocksMessage(long messageId,
Block block,
byte[] excludedTransactions)
Construct a Blocks message
|
BlocksMessage(long messageId,
java.util.List<? extends Block> blocks)
Construct a Blocks message
|
| Modifier and Type | Method and Description |
|---|---|
protected NetworkMessage |
constructMessage(java.nio.ByteBuffer bytes)
Construct the message from the message bytes
|
Block |
getBlock(java.util.List<Transaction> excludedTransactions)
Get the blocks
This method must be used if transactions were excluded in the GetBlock message
|
int |
getBlockCount()
Get the number of blocks
|
java.util.List<Block> |
getBlocks()
Get the blocks
This method cannot be used if transactions were excluded in the GetBlock message
|
public BlocksMessage(long messageId,
java.util.List<? extends Block> blocks)
messageId - Message identifierblocks - Block listpublic BlocksMessage(long messageId,
Block block,
byte[] excludedTransactions)
messageId - Message identifierblock - BlockexcludedTransactions - transactions to excludeprotected NetworkMessage constructMessage(java.nio.ByteBuffer bytes) throws java.nio.BufferOverflowException, java.nio.BufferUnderflowException, nxt.peer.NetworkException
constructMessage in class NetworkMessagebytes - Message bytes following the message namejava.nio.BufferOverflowException - Message buffer is too smalljava.nio.BufferUnderflowException - Message is too shortNetworkException - Message is not validpublic int getBlockCount()
public java.util.List<Block> getBlocks() throws NxtException.NotValidException
NxtException.NotValidException - Block is not validpublic Block getBlock(java.util.List<Transaction> excludedTransactions) throws NxtException.NotValidException
excludedTransactions - Transactions that were excluded from the blocksNxtException.NotValidException - Block is not valid