pass batch to process_block and process_block_header (#1594)

* use a batch consistently when processing blocks and headers

* rustfmt
This commit is contained in:
Antioch Peverell
2018-09-27 09:35:25 +01:00
committed by GitHub
parent 62fd8f2124
commit 56f84cc2f4
6 changed files with 170 additions and 135 deletions
+6 -13
View File
@@ -270,20 +270,13 @@ impl p2p::ChainAdapter for NetToChainAdapter {
return true;
}
// try to add each header to our header chain
for bh in bhs {
let res = w(&self.chain).sync_block_header(&bh, self.chain_opts());
if let &Err(ref e) = &res {
debug!(
LOGGER,
"Block header {} refused by chain: {:?}",
bh.hash(),
e
);
// try to add headers to our header chain
let res = w(&self.chain).sync_block_headers(&bhs, self.chain_opts());
if let &Err(ref e) = &res {
debug!(LOGGER, "Block headers refused by chain: {:?}", e);
if e.is_bad_data() {
return false;
}
if e.is_bad_data() {
return false;
}
}
true
+1
View File
@@ -397,6 +397,7 @@ impl Server {
// for release
let diff_stats = {
let diff_iter = self.chain.difficulty_iter();
let last_blocks: Vec<Result<(u64, Difficulty), consensus::TargetError>> =
global::difficulty_data_to_vector(diff_iter)
.into_iter()