Package nxt.peer
Class NetworkMessage
java.lang.Object
nxt.peer.NetworkMessage
- Direct Known Subclasses:
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
NetworkMessage represents the messages exchanged between peers.
Each network message has a common prefix followed by the message payload
- Message name (string)
- Protocol level (short)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe AddPeers message is sent to a peer to update its peer list and it is also returned as an asynchronous response to the GetPeers message Peer liststatic classThe BlockchainState message is sent when blockchain state changes.static classThe BlockIds message is returned in response to the GetNextBlockIds message.static classThe BlockInventory message is sent when a peer has received a new block.static classThe Blocks message is returned in response to the GetBlock and GetNextBlocks message.static classThe BundlerRate message is periodically broadcast when the peer has one or more active bundlers.static classThe CumulativeDifficulty message is returned in response to the GetCumulativeDifficulty message.static classThe Error message is returned when a error is detected while processing a request.static classThe GetBlock message is sent when a peer is notified that a new block is available.static classThe GetCumulativeDifficulty message is sent to a peer to get the current blockchain status.static classThe GetInfo message is exchanged when a peer connection is established.static classThe GetMilestoneBlockIds message is sent when a peer is downloading the blockchain.static classThe GetNextBlockIds message is sent when a peer is downloading the blockchain.static classThe GetNextBlocks message is sent when a peer is downloading the blockchain.static classThe GetPeers message is sent to a peer to request a list of connected peers.static classThe GetTransactions message is sent to retrieve one or more transactions.static classThe GetUnconfirmedTransactions message is sent to retrieve the current set of unconfirmed transactions.static classThe MilestoneBlockIds message is returned in response to the GetMilestoneBlockIds message.static classThe TransactionsInventory message is sent when a peer has received new transactions.static classThe Transactions message is returned in response to the GetTransactions and GetUnconfirmedTransactions messages. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum byte array lengthstatic final intMaximum list sizestatic final intThe max list size used in versions 2.3.2 and before.protected longMessage identifier -
Method Summary
Modifier and TypeMethodDescriptionprotected NetworkMessageconstructMessage(ByteBuffer bytes) Construct the message
-
Field Details
-
MAX_ARRAY_LENGTH
public static final int MAX_ARRAY_LENGTHMaximum byte array length- See Also:
-
MAX_LIST_SIZE
public static final int MAX_LIST_SIZEMaximum list size- See Also:
-
MAX_LIST_SIZE_PRE_2_3_3
public static final int MAX_LIST_SIZE_PRE_2_3_3The max list size used in versions 2.3.2 and before. TODO remove this constant after the network has upgraded to 2.3.3- See Also:
-
messageId
protected long messageIdMessage identifier
-
-
Method Details
-
constructMessage
protected NetworkMessage constructMessage(ByteBuffer bytes) throws BufferOverflowException, BufferUnderflowException, nxt.peer.NetworkException Construct the message- Parameters:
bytes- Message bytes following the message name- Returns:
- Message
- Throws:
BufferOverflowException- Message buffer is too smallBufferUnderflowException- Message is too shortnxt.peer.NetworkException- Message is not valid
-