mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
rustfmt
This commit is contained in:
parent
fd08c34474
commit
2d105deea7
3 changed files with 60 additions and 50 deletions
|
@ -76,7 +76,7 @@ impl NetAdapter for NetToChainAdapter {
|
|||
match res {
|
||||
Ok(_) => self.syncer.borrow().block_received(bhash),
|
||||
Err(chain::Error::Unfit(_)) => self.syncer.borrow().block_received(bhash),
|
||||
Err(_) => {},
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ impl Server {
|
|||
Seeding::WebStatic => {
|
||||
seed.connect_and_monitor(evt_handle.clone(), seed::web_seeds(evt_handle.clone()));
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if config.seeding_type != Seeding::None {
|
||||
|
|
|
@ -93,7 +93,12 @@ impl Syncer {
|
|||
let tip = self.chain.get_header_head()?;
|
||||
// TODO do something better (like trying to get more) if we lose peers
|
||||
let peer = self.p2p.most_work_peer().unwrap();
|
||||
debug!(LOGGER, "Sync: peer {} vs us {}", peer.info.total_difficulty, tip.total_difficulty);
|
||||
debug!(
|
||||
LOGGER,
|
||||
"Sync: peer {} vs us {}",
|
||||
peer.info.total_difficulty,
|
||||
tip.total_difficulty
|
||||
);
|
||||
|
||||
let more_headers = peer.info.total_difficulty > tip.total_difficulty;
|
||||
let more_bodies = {
|
||||
|
@ -167,7 +172,12 @@ impl Syncer {
|
|||
panic!("Failed to download required block {}", download.hash);
|
||||
}
|
||||
if download.retries < (elapsed / 5) as u8 {
|
||||
debug!(LOGGER, "Retry {} on block {}", download.retries, download.hash);
|
||||
debug!(
|
||||
LOGGER,
|
||||
"Retry {} on block {}",
|
||||
download.retries,
|
||||
download.hash
|
||||
);
|
||||
self.request_block(download.hash);
|
||||
download.retries += 1;
|
||||
}
|
||||
|
@ -180,11 +190,10 @@ impl Syncer {
|
|||
let h = blocks_to_download.pop().unwrap();
|
||||
self.request_block(h);
|
||||
count += 1;
|
||||
blocks_downloading.push(
|
||||
BlockDownload {
|
||||
blocks_downloading.push(BlockDownload {
|
||||
hash: h,
|
||||
start_time: Instant::now(),
|
||||
retries: 0
|
||||
retries: 0,
|
||||
});
|
||||
}
|
||||
debug!(
|
||||
|
@ -200,7 +209,9 @@ impl Syncer {
|
|||
pub fn block_received(&self, bh: Hash) {
|
||||
// just clean up the downloading list
|
||||
let mut bds = self.blocks_downloading.lock().unwrap();
|
||||
bds.iter().position(|ref h| h.hash == bh).map(|n| bds.remove(n));
|
||||
bds.iter().position(|ref h| h.hash == bh).map(
|
||||
|n| bds.remove(n),
|
||||
);
|
||||
}
|
||||
|
||||
/// Request some block headers from a peer to advance us
|
||||
|
@ -283,5 +294,4 @@ impl Syncer {
|
|||
debug!(LOGGER, "Error requesting block: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue