Replace Init with Handshake
This commit is contained in:
parent
618b976339
commit
03c24e4eed
@ -1,20 +1,17 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use aes_gcm::aead::{Aead, Payload};
|
||||
use aes_gcm::{Aes256Gcm, KeyInit};
|
||||
use anyhow::{Error, Result};
|
||||
use js_sys::Date;
|
||||
use anyhow::Result;
|
||||
use rand::{thread_rng, RngCore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Map, Value};
|
||||
use serde_json::Value;
|
||||
use sp_client::bitcoin::consensus::serialize;
|
||||
use sp_client::bitcoin::hex::{DisplayHex, FromHex};
|
||||
use sp_client::bitcoin::hex::DisplayHex;
|
||||
use sp_client::bitcoin::{OutPoint, Transaction};
|
||||
use tsify::Tsify;
|
||||
|
||||
use crate::crypto::AAD;
|
||||
use crate::error::AnkError;
|
||||
use crate::pcd::{Member, RoleDefinition};
|
||||
use crate::process::Process;
|
||||
use crate::signature::Proof;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Tsify)]
|
||||
@ -24,7 +21,7 @@ pub enum AnkFlag {
|
||||
Faucet,
|
||||
Cipher,
|
||||
Commit,
|
||||
Init,
|
||||
Handshake,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
@ -35,7 +32,7 @@ impl From<&str> for AnkFlag {
|
||||
"Faucet" => Self::Faucet,
|
||||
"Cipher" => Self::Cipher,
|
||||
"Commit" => Self::Commit,
|
||||
"Init" => Self::Init,
|
||||
"Handshake" => Self::Handshake,
|
||||
_ => Self::Unknown,
|
||||
}
|
||||
}
|
||||
@ -54,7 +51,7 @@ impl AnkFlag {
|
||||
1 => Self::Faucet,
|
||||
2 => Self::Cipher,
|
||||
3 => Self::Commit,
|
||||
4 => Self::Init,
|
||||
4 => Self::Handshake,
|
||||
_ => Self::Unknown,
|
||||
}
|
||||
}
|
||||
@ -65,7 +62,7 @@ impl AnkFlag {
|
||||
Self::Faucet => "Faucet",
|
||||
Self::Cipher => "Cipher",
|
||||
Self::Commit => "Commit",
|
||||
Self::Init => "Init",
|
||||
Self::Handshake => "Handshake",
|
||||
Self::Unknown => "Unknown",
|
||||
}
|
||||
}
|
||||
@ -173,14 +170,14 @@ impl NewTxMessage {
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Tsify)]
|
||||
#[tsify(into_wasm_abi, from_wasm_abi)]
|
||||
pub struct InitMessage {
|
||||
pub struct HandshakeMessage {
|
||||
pub sp_address: String,
|
||||
pub peers_list: Option<String>,
|
||||
pub processes_list: Option<String>,
|
||||
pub peers_list: HashMap<Member, OutPoint>,
|
||||
pub processes_list: HashMap<OutPoint, Process>,
|
||||
}
|
||||
|
||||
impl InitMessage {
|
||||
pub fn new(sp_address: String, peers_list: Option<String>, processes_list: Option<String>) -> Self {
|
||||
impl HandshakeMessage {
|
||||
pub fn new(sp_address: String, peers_list: HashMap<Member, OutPoint>, processes_list: HashMap<OutPoint, Process>) -> Self {
|
||||
Self {
|
||||
sp_address,
|
||||
peers_list,
|
||||
|
Loading…
x
Reference in New Issue
Block a user