ethcore sync decodes rlp less often#9264
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.
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.
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.
it lets us avoid unnecessary searches in the hashmap, and unnecessary copying of the blocks (few lines below)
andresilva
left a comment
There was a problem hiding this comment.
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.
Do you think it's important to keep the logging message? Or will this be logged elsewhere?
There was a problem hiding this comment.
it's already logged upstream :)
| self.highest_block = Some(number); | ||
| } | ||
| let hash = info.hash(); | ||
| let hdr = r.at(i).map_err(|e| { |
There was a problem hiding this comment.
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