| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- use std::io;
- use darkfi::{
- crypto::{keypair::PublicKey, schnorr::Signature},
- impl_vec, net,
- util::serial::{Decodable, Encodable, SerialDecodable, SerialEncodable, VarInt},
- Result,
- };
- /// This struct represents a Vote, used by Streamlet consensus.
- #[derive(Debug, Clone, PartialEq, SerialDecodable, SerialEncodable)]
- pub struct Vote {
- /// Node public key
- pub public_key: PublicKey,
- /// signed block
- pub vote: Signature,
- /// block proposal hash to vote on
- pub proposal: blake3::Hash,
- /// Slot uid, generated by the beacon
- pub sl: u64,
- /// node id
- pub id: u64,
- }
- impl Vote {
- pub fn new(
- public_key: PublicKey,
- vote: Signature,
- proposal: blake3::Hash,
- sl: u64,
- id: u64,
- ) -> Vote {
- Vote { public_key, vote, proposal, sl, id }
- }
- }
- impl net::Message for Vote {
- fn name() -> &'static str {
- "vote"
- }
- }
- impl_vec!(Vote);
|