Fixed valid response condition

This commit is contained in:
arkpar 2016-06-14 13:25:06 +02:00
parent 9ed2122ae2
commit 65d42d6a5a

View File

@ -410,7 +410,7 @@ impl ChainSync {
let mut headers = Vec::new();
let mut hashes = Vec::new();
let mut valid_response = false;
let mut valid_response = item_count == 0; //empty response is valid
for i in 0..item_count {
let info: BlockHeader = try!(r.val_at(i));
let number = BlockNumber::from(info.number);
@ -455,7 +455,6 @@ impl ChainSync {
trace!(target: "sync", "{} Disabled for invalid headers response", peer_id);
self.deactivate_peer(io, peer_id);
}
else {
match self.state {
SyncState::ChainHead => {
if headers.is_empty() {
@ -476,7 +475,6 @@ impl ChainSync {
},
_ => trace!(target: "sync", "Unexpected headers({}) from {} ({}), state = {:?}", headers.len(), peer_id, io.peer_info(peer_id), self.state)
}
}
self.collect_blocks(io);
self.continue_sync(io);