Add chain_tip to HandshakeMessage and rm SyncMessage
This commit is contained in:
parent
5447e1c06c
commit
6e3a13554c
@ -168,45 +168,16 @@ pub struct HandshakeMessage {
|
|||||||
pub sp_address: String,
|
pub sp_address: String,
|
||||||
pub peers_list: OutPointMemberMap,
|
pub peers_list: OutPointMemberMap,
|
||||||
pub processes_list: OutPointProcessMap,
|
pub processes_list: OutPointProcessMap,
|
||||||
// pub chain_tip: u64,
|
pub chain_tip: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HandshakeMessage {
|
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 {
|
Self {
|
||||||
sp_address,
|
sp_address,
|
||||||
peers_list,
|
peers_list,
|
||||||
processes_list,
|
processes_list,
|
||||||
// chain_tip,
|
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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user