store cumulative cost in pending request set.

This commit is contained in:
Robert Habermeier
2017-03-22 19:26:51 +01:00
parent c718b5618e
commit e3d6525d83
4 changed files with 56 additions and 20 deletions

View File

@@ -418,8 +418,10 @@ impl<L: AsLightClient> LightSync<L> {
let best_td = chain_info.pending_total_difficulty;
let sync_target = match *self.best_seen.lock() {
Some(ref target) if target.head_td > best_td => (target.head_num, target.head_hash),
_ => {
trace!(target: "sync", "No target to sync to.");
ref other => {
let network_score = other.as_ref().map(|target| target.head_td);
trace!(target: "sync", "No target to sync to. Network score: {:?}, Local score: {:?}",
network_score, best_td);
*state = SyncState::Idle;
return;
}