compare genesis during peering handshake (#327)

* wip - send genesis in handshake
* error if genesis mismatch on handshake
* fix the tests
* preserve order of existing fields in hand/shake
This commit is contained in:
AntiochP 2017-11-20 12:35:52 -05:00 committed by Simon B
parent e50703d79e
commit 487e50c3d2

View file

@ -85,11 +85,12 @@ impl Server {
capab: Capabilities, capab: Capabilities,
config: P2PConfig, config: P2PConfig,
adapter: Arc<ChainAdapter>, adapter: Arc<ChainAdapter>,
genesis: Hash,
) -> Result<Server, Error> { ) -> Result<Server, Error> {
Ok(Server { Ok(Server {
config: config, config: config,
capabilities: capab, capabilities: capab,
handshake: Arc::new(Handshake::new()), handshake: Arc::new(Handshake::new(genesis)),
peers: Peers::new(PeerStore::new(db_root)?, adapter), peers: Peers::new(PeerStore::new(db_root)?, adapter),
stop: RefCell::new(None), stop: RefCell::new(None),
}) })