Re-implemented the whole interaction between server, peer and protocol to be more Rust-ish. Server maintains peer references and protocol is internally mutable.

This commit is contained in:
Ignotus Peverell
2016-10-29 12:36:45 -07:00
parent fdaf2ba6af
commit 42769c373c
9 changed files with 232 additions and 194 deletions
+1 -1
View File
@@ -218,7 +218,7 @@ impl Block {
// repeated iterations, revisit if a problem
// validate each transaction and gather their proofs
let mut proofs = try_oap_vec!(txs, |tx| tx.verify_sig(&secp));
let mut proofs = try_map_vec!(txs, |tx| tx.verify_sig(&secp));
proofs.push(reward_proof);
// build vectors with all inputs and all outputs, ordering them by hash
+1 -1
View File
@@ -29,7 +29,7 @@ macro_rules! map_vec {
/// Same as map_vec when the map closure returns Results. Makes sure the
/// results are "pushed up" and wraps with a try.
#[macro_export]
macro_rules! try_oap_vec {
macro_rules! try_map_vec {
($thing:expr, $mapfn:expr ) => {
try!($thing.iter()
.map($mapfn)