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

blockchain import_route #645

Merged
merged 5 commits into from
Mar 10, 2016
Merged

blockchain import_route #645

merged 5 commits into from
Mar 10, 2016

Conversation

debris
Copy link
Collaborator

@debris debris commented Mar 9, 2016

cc @tomusdrw . You probably need it :)

@debris debris added the A0-pleasereview 🤓 Pull request needs code review. label Mar 9, 2016
pub struct ImportRoute {
/// Blocks that were invalidated by new block.
pub invalidated_blocks: Vec<H256>,
/// Blocks that were validted by new block.
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo

@tomusdrw
Copy link
Collaborator

tomusdrw commented Mar 9, 2016

In BlockLocation::BranchBecomingCanonChain you have route and old_route and then it becomes validated_blocks and invalidated_blocks contained in ImportRoute. I'm not convinced about those names.

What about something like InsertResult (method is called insert_block) with canon_blocks and retracted_blocks or even reusing same enum instead of BlockLocation.

enum InsertResult/InsertLocation {
  CanonChain(route),
  Branch(route),
  BranchBecameCanonChain(retracted_route/invalidated_route, route)
}

@tomusdrw tomusdrw added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. and removed A0-pleasereview 🤓 Pull request needs code review. A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Mar 9, 2016
@debris
Copy link
Collaborator Author

debris commented Mar 9, 2016

canon_blocks / retracted_blocks sounds good for me.

But regarding this enum:

enum InsertResult/InsertLocation {
  CanonChain(route),
  Branch(route),
  BranchBecameCanonChain(retracted_route/invalidated_route, route)
}

there is no reason to have route for branch / canonchain. Branch does not have a route at all, and for canon chain, route == inserted block hash. I would prefer to keep InsertResult/InsertLocation structures separate, cause it's easier to use them.

@tomusdrw
Copy link
Collaborator

tomusdrw commented Mar 9, 2016

Agreed. What about ImportRoute name?

@debris
Copy link
Collaborator Author

debris commented Mar 9, 2016

I'm open for other ideas. Current name comes from cpp implementation.

@tomusdrw
Copy link
Collaborator

tomusdrw commented Mar 9, 2016

I vote for keeping it consistent with cpp or calling it InsertResult. Up to you.

@debris debris added A0-pleasereview 🤓 Pull request needs code review. and removed A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. labels Mar 9, 2016
@@ -42,6 +44,8 @@ pub enum BlockLocation {
/// Hash of the newest common ancestor with old canon chain.
ancestor: H256,
/// Hashes of the blocks between ancestor and this block.
route: Vec<H256>
route: Vec<H256>,
Copy link
Contributor

Choose a reason for hiding this comment

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

enacted

@gavofyork gavofyork added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 10, 2016
@gavofyork
Copy link
Contributor

prefer snappier naming than the asymmetric route and old_route.

@debris debris added A0-pleasereview 🤓 Pull request needs code review. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Mar 10, 2016
@gavofyork gavofyork added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 10, 2016
gavofyork added a commit that referenced this pull request Mar 10, 2016
@gavofyork gavofyork merged commit 16e12b1 into master Mar 10, 2016
@gavofyork gavofyork deleted the import_route branch March 10, 2016 12:14
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.

3 participants