mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-07 03:22:20 +00:00
25 lines
469 B
Rust
25 lines
469 B
Rust
pub enum WireMessageType {
|
|
Status,
|
|
NewBlockHashes,
|
|
GetBlockHashes,
|
|
BlockHashes,
|
|
GetBlocks,
|
|
Blocks,
|
|
NewBlock,
|
|
}
|
|
|
|
|
|
/// Determines the message type of some given
|
|
/// message.
|
|
///
|
|
/// Does not check the validity of the message data,
|
|
/// it just reads the first byte.
|
|
pub fn message_type(message: &Vec<u8>)
|
|
-> Option<WireMessageType>
|
|
{
|
|
match message.get(0) {
|
|
Some(0x06) => Some(WireMessageType::Blocks),
|
|
_ => None
|
|
}
|
|
}
|