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

More sync and propagation fixes #420

Merged
merged 10 commits into from Feb 15, 2016
Merged

More sync and propagation fixes #420

merged 10 commits into from Feb 15, 2016

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Feb 12, 2016

fixes #419

@arkpar arkpar added the A0-pleasereview 🤓 Pull request needs code review. label Feb 12, 2016
@arkpar
Copy link
Collaborator Author

arkpar commented Feb 12, 2016

Propagation logic was changed a bit. Check for latest peer hash being too far behind has been removed - we don't know how far it has synced from other peers and should not keep it in the dark. Instead there is now a limit on how many blocks/hashes to send at once.

@@ -437,6 +448,10 @@ impl ChainSync {
trace!(target: "sync", "{} -> NewBlock ({})", peer_id, h);
let header: BlockHeader = try!(header_rlp.as_val());
let mut unknown = false;
{
let peer = self.peers.get_mut(&peer_id).expect("ChainSync: unknown peer");
Copy link
Contributor

Choose a reason for hiding this comment

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

this expect doesn't look like it's a fundamental logic error. if it is, add a comment explaining why it can never ever happen and other pre-condition assert!s in the code to make the proof clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

i notice that there are others in the code, so happy for the whole lot to be cleared up in a later PR if preferable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Better fix that now

@gavofyork
Copy link
Contributor

quite a logically complex PR - a bit of explanation of what's going on would be appreciated.

@@ -162,6 +162,8 @@ struct PeerInfo {
asking: PeerAsking,
/// A set of block numbers being requested
asking_blocks: Vec<BlockNumber>,
/// Holds requested header hash if currently requesting block header by hash
asking_hash: Option<H256>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Normally headers and bodies are downloaded by number, unless downloading a header known from NewBlockHashes packet. Currently, if two NewBlockHash packets with the same hash arrive at the same time this may result in same header being requested twice. This was added to keep track of the requested hash.

@arkpar arkpar added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 12, 2016
@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Feb 12, 2016
@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 Feb 14, 2016
@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 Feb 14, 2016
@NikVolf NikVolf added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 15, 2016
@NikVolf
Copy link
Contributor

NikVolf commented Feb 15, 2016

lgtm
needs merging with master

gavofyork pushed a commit that referenced this pull request Feb 15, 2016
More sync and propagation fixes
@gavofyork gavofyork merged commit 9f03640 into master Feb 15, 2016
@debris debris deleted the net branch February 17, 2016 16:01
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic during sync with 'new peer already exists'
3 participants