Add chain_tip to HandshakeMessage and rm SyncMessage
This commit is contained in:
parent
92c777dbef
commit
af3f1879f9
@ -168,45 +168,16 @@ pub struct HandshakeMessage {
|
||||
pub sp_address: String,
|
||||
pub peers_list: OutPointMemberMap,
|
||||
pub processes_list: OutPointProcessMap,
|
||||
// pub chain_tip: u64,
|
||||
pub chain_tip: u32,
|
||||
}
|
||||
|
||||
impl HandshakeMessage {
|
||||
pub fn new(sp_address: String, peers_list: OutPointMemberMap, processes_list: OutPointProcessMap) -> Self {
|
||||
pub fn new(sp_address: String, peers_list: OutPointMemberMap, processes_list: OutPointProcessMap, chain_tip: u32) -> Self {
|
||||
Self {
|
||||
sp_address,
|
||||
peers_list,
|
||||
processes_list,
|
||||
// chain_tip,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
serde_json::to_string(self).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Tsify)]
|
||||
pub enum SyncMessageContent {
|
||||
Tweaks,
|
||||
WholeBlocks,
|
||||
Headers,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Tsify)]
|
||||
#[tsify(into_wasm_abi, from_wasm_abi)]
|
||||
pub struct SyncMessage {
|
||||
start: u32,
|
||||
end: u32,
|
||||
content: SyncMessageContent,
|
||||
}
|
||||
|
||||
impl SyncMessage {
|
||||
pub fn new(start: u32, end: u32, content: SyncMessageContent) -> Self {
|
||||
Self {
|
||||
start,
|
||||
end,
|
||||
content,
|
||||
chain_tip,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user