aboutsummaryrefslogblamecommitdiff
path: root/src/proto.rs
blob: d51aa36bef2fbce5d507e10b688080d4e634ef0c (plain) (tree)
1
2
3
4
5
6
7
8
9
                                    
                         
                        
 

                   

                                                               
 
                                        



                          
                              


                                

                                               

                             
 


                                        
                       
 
                                      

                          
use serde::{Deserialize, Serialize};
use std::net::SocketAddr;
use std::time::Duration;

use crate::data::*;

pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
pub const BLOCK_RW_TIMEOUT: Duration = Duration::from_secs(42);

#[derive(Debug, Serialize, Deserialize)]
pub struct PingMessage {
	pub id: UUID,
	pub rpc_port: u16,

	pub status_hash: Hash,
	pub config_version: u64,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AdvertisedNode {
	pub id: UUID,
	pub addr: SocketAddr,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct PutBlockMessage {
	pub hash: Hash,

	#[serde(with = "serde_bytes")]
	pub data: Vec<u8>,
}