mirror of https://github.com/poanetwork/hbbft.git
removed redundant dependency on error_chain; corrected vector indices
This commit is contained in:
parent
6eea0d443e
commit
e9b0add188
|
@ -10,7 +10,6 @@ reed-solomon-erasure = "3.0"
|
|||
merkle = { git = "https://github.com/vkomenda/merkle.rs", branch = "public-proof" }
|
||||
ring = "^0.12"
|
||||
rand = "*"
|
||||
error-chain = "0.11"
|
||||
protobuf = "1.4.4"
|
||||
crossbeam = "0.3.2"
|
||||
crossbeam-channel = "0.1"
|
||||
|
|
|
@ -59,8 +59,6 @@ where Vec<u8>: From<T>
|
|||
|
||||
/// Broadcast stage task returning the computed values in case of success,
|
||||
/// and an error in case of failure.
|
||||
///
|
||||
/// TODO: Detailed error status.
|
||||
pub fn run(&mut self) -> Result<T, BroadcastError> {
|
||||
// Broadcast state machine thread.
|
||||
let bvalue = self.broadcast_value.to_owned();
|
||||
|
@ -166,7 +164,7 @@ where T: Clone + Debug + Send + Sync + Into<Vec<u8>>
|
|||
// Rest of the proofs are sent to remote nodes.
|
||||
tx.send(
|
||||
TargetedMessage {
|
||||
target: Target::Node(i + 1),
|
||||
target: Target::Node(i),
|
||||
message: Message::Broadcast(
|
||||
BroadcastMessage::Value(proof))
|
||||
}).unwrap();
|
||||
|
@ -248,8 +246,6 @@ where T: Clone + Debug + Eq + Hash + Send + Sync + Into<Vec<u8>>
|
|||
continue;
|
||||
}
|
||||
|
||||
debug!("Broadcast node {} -> Value {:?}", i, p);
|
||||
|
||||
if let None = root_hash {
|
||||
root_hash = Some(p.root_hash.clone());
|
||||
}
|
||||
|
@ -273,8 +269,6 @@ where T: Clone + Debug + Eq + Hash + Send + Sync + Into<Vec<u8>>
|
|||
|
||||
// An echo received. Verify the proof it contains.
|
||||
BroadcastMessage::Echo(p) => {
|
||||
debug!("Broadcast node {} -> Echo {:?}", i, p);
|
||||
|
||||
if let None = root_hash {
|
||||
root_hash = Some(p.root_hash.clone());
|
||||
}
|
||||
|
@ -326,8 +320,6 @@ where T: Clone + Debug + Eq + Hash + Send + Sync + Into<Vec<u8>>
|
|||
},
|
||||
|
||||
BroadcastMessage::Ready(ref h) => {
|
||||
debug!("Broadcast node {} -> Ready {:?}", i, h);
|
||||
|
||||
// TODO: Prioritise the Value root hash, possibly. Prevent
|
||||
// an incorrect node from blocking progress which it could
|
||||
// achieve by sending an incorrect hash.
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
//! Template-assisted definition of the crate's error strategy.
|
||||
|
||||
error_chain! {
|
||||
}
|
|
@ -36,8 +36,6 @@
|
|||
|
||||
#![feature(optin_builtin_traits)]
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate protobuf;
|
||||
extern crate ring;
|
||||
|
@ -49,7 +47,6 @@ extern crate reed_solomon_erasure;
|
|||
|
||||
mod connection;
|
||||
mod messaging;
|
||||
mod errors;
|
||||
mod proto;
|
||||
mod task;
|
||||
mod commst;
|
||||
|
|
18
src/node.rs
18
src/node.rs
|
@ -67,8 +67,10 @@ where Vec<u8>: From<T>
|
|||
0)
|
||||
.run()
|
||||
{
|
||||
Ok(t) => debug!("Broadcast instance 0 succeeded: {}",
|
||||
String::from_utf8(Vec::from(t)).unwrap()),
|
||||
Ok(t) => {
|
||||
debug!("Broadcast instance 0 succeeded: {}",
|
||||
String::from_utf8(Vec::from(t)).unwrap());
|
||||
},
|
||||
Err(_) => error!("Sender broadcast instance failed")
|
||||
}
|
||||
});
|
||||
|
@ -102,11 +104,13 @@ where Vec<u8>: From<T>
|
|||
node_index)
|
||||
.run()
|
||||
{
|
||||
Ok(t) => debug!("Broadcast instance {} succeeded: {}",
|
||||
i,
|
||||
String::from_utf8(
|
||||
Vec::from(t)
|
||||
).unwrap()),
|
||||
Ok(t) => {
|
||||
debug!("Broadcast instance {} succeeded: {}",
|
||||
node_index,
|
||||
String::from_utf8(
|
||||
Vec::from(t)
|
||||
).unwrap());
|
||||
},
|
||||
Err(_) => error!("Broadcast instance {} failed", i)
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue