ouroboros-network
ouroboros-network copied to clipboard
message id validation
The id is a Blake2b hash, ref:
pub async fn build(&self, message_bytes: &[u8]) -> StdResult<DmqMsg> {
fn compute_msg_id(dmq_message: &DmqMsg) -> Vec<u8> {
let mut hasher = Blake2b::<U64>::new();
hasher.update(&dmq_message.msg_body);
hasher.update(dmq_message.block_number.to_be_bytes());
hasher.update(dmq_message.ttl.to_be_bytes());
hasher.update(&dmq_message.kes_signature);
hasher.update(&dmq_message.operational_certificate);
hasher.update(dmq_message.kes_period.to_be_bytes());
hasher.finalize().to_vec()
}