Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peer: Introduce v2 module. #1834

Merged
merged 6 commits into from
Aug 12, 2019
Merged

peer: Introduce v2 module. #1834

merged 6 commits into from
Aug 12, 2019

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Aug 12, 2019

This requires #1833.

In order to make use of chaincfg/v2 and blockchain/v2, a new major version of the peer module is required because peer/v1 accepts and returns types from both chaincfg/v1 and blockchain/v1 in its API.

Since a new major version is required, this also takes the opportunity to remove the tight coupling to both chaincfg and blockchain as follows:

  • Remove the deprecated and sole reference to *chaincfg.Params from its API.
  • Accept []chainhash.Hash for block locators in PushGetBlocksMsg and PushGetHeadersMsg instead of blockchain.BlockLocator.

Consequently, this introduces peer/v2. A series of individual commits is provided to make the review process easier. Each commit message more thoroughly describes its purpose, but primarily they consist of the following:

  • Freeze version 1 of the peer module use
  • Remove the root module peer override so building the software will still produce binaries based on the v1 module until the v2 module is fully released
  • Remove deprecated Config.ChainParams field
  • Accept []chainhash.Hash in PushGetBlocksMsg and PushGetHeadersMsg instead of blockchain.Locator
  • Remove the dependency on chaincfg.
  • Remove the dependency on blockchain.
  • Bump the module version to v2
  • Update docs for the new module version

Finally, it should also be noted that this only introduces the new module and does not update anything to make use of it yet, so building the software will still produce binaries based on the v1 module.

@davecgh davecgh added this to the 1.5.0 milestone Aug 12, 2019
Copy link
Member

@dnldd dnldd left a comment

Choose a reason for hiding this comment

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

Commit message has a typo, to remote should be to remove.

Looks good besides that.

This freezes the root module usage of the peer module by removing the
replacement and bumping the required version.  This means building the
software will still produce binaries based on the v1 module until the v2
module is fully released.

All future releases will be moving to version 2 of the module.

Consequently, it bumps the required module versions as follows:

- github.com/decred/dcrd/peer@v1.2.0
This removes the deprecated ChainParams field from the Config struct and
updates the tests accordingly.

It also removes the dependency on the chaincfg module since it is no
longer required.
This modifies the PushGetBlocksMsg and PushGetHeadersMsg functions to
accept a string of block loactors hashes instead of a concrete
blockchain.BlockLocator to remove the tight couping between the two
packages at the API boundary and allow callers to easily provide custom
values if desired.

It also removes the dependency on the blockchain module since it is no
longer required.
This udpates the peer module to use the latest module major versions.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/txscript/v2@v2.0.0
@davecgh
Copy link
Member Author

davecgh commented Aug 12, 2019

@dnldd Thanks. Updated typo.

@davecgh davecgh merged commit e523e05 into decred:master Aug 12, 2019
@davecgh davecgh deleted the peer_introduce_v2 branch August 12, 2019 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants