Code cleanup in the sync module (#11552)

* Code cleanup

`flush_queue()` is mostly used by tests
remove some unused params
avoid clones in a few places

* Consistent params naming
Consistent use of log calls

* Fix todo

It'a actually not trivial to find out the size of these collections, likely we keep blocks from all kinds of forks in the `self.blocks`/`self.parents` collections and there's no good way to anticipate how many blocks we're going to drain. Most of the time we end up draining 0 blocks and then we drain a whole bunch of them, up to 30 000.

* Revert making flush_queue() test-only
Address review grumbles

* More review grumbles

* fix build
This commit is contained in:
David
2020-03-09 20:04:50 +01:00
committed by GitHub
parent 10d82ef119
commit 9e77e7e193
4 changed files with 83 additions and 76 deletions

View File

@@ -197,8 +197,8 @@ pub trait IoClient: Sync + Send {
/// Queue transactions for importing.
fn queue_transactions(&self, transactions: Vec<Bytes>, peer_id: usize);
/// Queue block import with transaction receipts. Does no sealing and transaction validation.
fn queue_ancient_block(&self, block_bytes: Unverified, receipts_bytes: Bytes) -> EthcoreResult<H256>;
/// Queue block import with transaction receipts. Does no sealing or transaction validation.
fn queue_ancient_block(&self, unverified: Unverified, receipts_bytes: Bytes) -> EthcoreResult<H256>;
/// Queue consensus engine message.
fn queue_consensus_message(&self, message: Bytes);