Split IO and network crates (#1828)

* Abort on panic

* Split IO and network crates

* Restore panic handler

* Fixed doc tests
This commit is contained in:
Arkadiy Paronyan
2016-08-05 10:32:04 +02:00
committed by Marek Kotewicz
parent 08f30fc1a8
commit 05bfdc508e
66 changed files with 464 additions and 344 deletions

View File

@@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use util::*;
use network::NetworkError;
use ethcore::header::{ Header as BlockHeader};
known_heap_size!(0, HeaderId, SyncBlock);
@@ -228,7 +229,7 @@ impl BlockCollection {
self.downloading_headers.contains(hash) || self.downloading_bodies.contains(hash)
}
fn insert_body(&mut self, b: Bytes) -> Result<(), UtilError> {
fn insert_body(&mut self, b: Bytes) -> Result<(), NetworkError> {
let body = UntrustedRlp::new(&b);
let tx = try!(body.at(0));
let tx_root = ordered_trie_root(tx.iter().map(|r| r.as_raw().to_vec()).collect()); //TODO: get rid of vectors here
@@ -249,13 +250,13 @@ impl BlockCollection {
},
None => {
warn!("Got body with no header {}", h);
Err(UtilError::Network(NetworkError::BadProtocol))
Err(NetworkError::BadProtocol)
}
}
}
None => {
trace!(target: "sync", "Ignored unknown/stale block body");
Err(UtilError::Network(NetworkError::BadProtocol))
Err(NetworkError::BadProtocol)
}
}
}