Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Sync reorg up to history size #3874

Merged
merged 5 commits into from
Dec 23, 2016
Merged

Sync reorg up to history size #3874

merged 5 commits into from
Dec 23, 2016

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Dec 16, 2016

  • Fixed an issue with sync not being able to recover from a long fork.
  • Fixed another issue with peer difficulty not being tracked properly.
  • Set default history size back to 1200.

@arkpar arkpar added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. M4-core ⛓ Core client code / Rust. labels Dec 16, 2016
@@ -1309,6 +1311,7 @@ impl BlockChainClient for Client {
PruningInfo {
earliest_chain: self.chain.read().first_block_number().unwrap_or(1),
earliest_state: self.state_db.lock().journal_db().earliest_era().unwrap_or(0),
history_size: Some(self.history),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be state_history_size

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 1302b39 on sync-search into ** on master**.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 85.892% when pulling 7854a23 on sync-search into adb0f6f on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 85.866% when pulling 63ba279 on sync-search into e755c09 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 85.871% when pulling 2a4530e on sync-search into 14a9942 on master.

@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 19, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 85.862% when pulling b2b242f on sync-search into 14a9942 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 85.897% when pulling b2b242f on sync-search into 14a9942 on master.

@arkpar arkpar added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 19, 2016
@arkpar arkpar added this to the 1.5 Tenuity milestone Dec 19, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 85.854% when pulling a7e71a1 on sync-search into b369939 on master.

@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 21, 2016
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 69eac0a on sync-search into ** on master**.

@@ -1245,7 +1245,9 @@ impl BlockChainClient for Client {
}

fn chain_info(&self) -> BlockChainInfo {
self.chain.read().chain_info()
let mut chain_info = self.chain.read().chain_info();
chain_info.pending_total_difficulty = chain_info.total_difficulty + self.block_queue.total_difficulty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we often have multiple competing blocks from different forks in the queue? (i.e. this value will often be higher than the actual total difficulty of the best queued block)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to make a decision whether to try and sync to a peer for a full sync. When the queue is full we don't care much if this is precise. When it is empty or nearly empty and we are far behind we don't care either. For the up-to date sync to unknown hashes this is not used because there's no way to get other peer's total difficulty. We treat it as unknown and try and download these new blocks anyway.

@rphmeier rphmeier added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 23, 2016
@gavofyork gavofyork merged commit 5a3c3bc into master Dec 23, 2016
@gavofyork gavofyork deleted the sync-search branch December 23, 2016 17:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants