-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Please rebase/merge master (which already includes #9252). |
hashes.push(head); | ||
self.head = Some(head); | ||
} else { | ||
self.blocks.insert(head, block); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So previously this would have removed an already downloaded header? So adding it back is just preventing it from being downloaded again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the logic has not changed here. previously we called self.blocks.get(...)
(line 281) and then self.blocks.remove(...)
line 303. Now we are instantly removing self.blocks.remove(...)
(line 361), but we need to readd blocks that shouldn't be removed (this line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it lets us avoid unnecessary searches in the hashmap, and unnecessary copying of the blocks (few lines below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This was definitely in need of a cleanup 👍.
BlockDownloaderImportError::Invalid | ||
})?; | ||
let number = BlockNumber::from(info.number()); | ||
let info = SyncHeader::from_rlp(r.at(i)?.as_raw().to_vec())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's important to keep the logging message? Or will this be logged elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's already logged upstream :)
continue; | ||
} | ||
|
||
if self.highest_block.as_ref().map_or(true, |n| number > *n) { | ||
self.highest_block = Some(number); | ||
} | ||
let hash = info.hash(); | ||
let hdr = r.at(i).map_err(|e| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were decoding this twice in the same function just because... 😱
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: Allow setting the panic hook with parity-clib (openethereum#9292) Prevent blockchain & miner racing when accessing pending block. (openethereum#9310) Docker alpine: use multi-stage concept (openethereum#9269) Update `log` -> 0.4, `env_logger` -> 0.5. (openethereum#9294) Update tobalaba.json (openethereum#9313) Allow tx pool to be Send (openethereum#9315) Fix codecov.io badge in README (openethereum#9327) Move ethereum-specific H256FastMap type to own crate (openethereum#9307) ethcore sync decodes rlp less often (openethereum#9264)
should be merged after #9252