Get chatter between shard and core working

This commit is contained in:
James Wilson
2021-06-16 11:57:58 +01:00
parent 2b0accbbb6
commit 3a527e69c8
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -18,6 +18,12 @@ impl From<Hash> for crate::types::BlockHash {
}
}
impl From<crate::types::BlockHash> for Hash {
fn from(hash: crate::types::BlockHash) -> Self {
Hash(hash.0)
}
}
struct HashVisitor;
impl<'de> Visitor<'de> for HashVisitor {
+3 -1
View File
@@ -10,6 +10,7 @@ use common::util::{DenseMap};
use common::types::{ConnId, NodeDetails, NodeId, BlockHash};
use common::node::Payload;
use common::shard::{ShardConnId, ShardMessage, BackendMessage};
use common::json;
use soketto::handshake::{Client, ServerResponse};
use crate::node::{NodeConnector, Initialize};
use tokio::net::TcpStream;
@@ -138,7 +139,8 @@ impl Chain {
pub async fn connect(&self, tx: UnboundedSender<ChainMessage>) -> anyhow::Result<WsSender> {
let host = self.url.host().unwrap_or("127.0.0.1");
let port = self.url.port_u16().unwrap_or(8000);
let path = format!("{}{}", self.url.path(), self.genesis_hash);
let json_hash: json::Hash = self.genesis_hash.into();
let path = format!("{}{}", self.url.path(), json_hash);
let socket = TcpStream::connect((host, port)).await?;