Minor fix in chain supplier and light provider (#8906)

* fix chain supplier increment

* fix light provider block_headers
This commit is contained in:
André Silva
2018-06-15 16:30:34 +01:00
committed by Andrew Jones
parent 083b1d1a5d
commit 34511c3b04
2 changed files with 9 additions and 6 deletions

View File

@@ -1579,7 +1579,7 @@ impl ChainSync {
let max_count = cmp::min(MAX_HEADERS_TO_SEND, max_headers);
let mut count = 0;
let mut data = Bytes::new();
let inc = (skip + 1) as BlockNumber;
let inc = skip.saturating_add(1) as BlockNumber;
let overlay = io.chain_overlay().read();
while number <= last && count < max_count {
@@ -1598,10 +1598,10 @@ impl ChainSync {
if number <= inc || number == 0 {
break;
}
number -= inc;
number = number.saturating_sub(inc);
}
else {
number += inc;
number = number.saturating_add(inc);
}
}
let mut rlp = RlpStream::new_list(count as usize);