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

[BCN, BWS, CWC, Bitcore-libs] Add named testnets to as networks #3714

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

escottalexander
Copy link
Contributor

This PR adds support for named testnets. The bulk of the complexity is in alias resolution so that we maintain backwards compatibility.

We should create another PR with front end updates for BWC and Insight.

Copy link
Collaborator

@kajoseph kajoseph left a comment

Choose a reason for hiding this comment

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

Wanted to go ahead and get this to you. Consider this a WIP review. I haven't gone back through it after discussing the networks with you

packages/bitcore-lib-cash/lib/networks.js Outdated Show resolved Hide resolved
packages/bitcore-lib-doge/lib/networks.js Outdated Show resolved Hide resolved
packages/bitcore-lib-ltc/lib/networks.js Outdated Show resolved Hide resolved
packages/bitcore-lib/lib/networks.js Outdated Show resolved Hide resolved
packages/bitcore-wallet-service/src/lib/common/utils.ts Outdated Show resolved Hide resolved
packages/bitcore-wallet-service/src/lib/common/utils.ts Outdated Show resolved Hide resolved
packages/bitcore-wallet-service/src/lib/server.ts Outdated Show resolved Hide resolved
if(!_.isUndefined(networkValue) && !_.isObject(networkValue)) {
if(!networkMaps[networkValue]) {
networkMaps[networkValue] = [];
for (const value of Object.values(network)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this should actually be something like

const indexBy = data.indexBy || Object.values(network);
for (const value of indexBy) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the point of the indexBy properties on the regtest network? I don't understand why we are handling BCH differently here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's to be able to specify which values you want to add to the networkMap. Yeah, it doesn't seem useful to me either. It could be useful in theory. I'm not sure why regtest is is the only one that has it. Maybe a previous regtest had key values that conflicted w/ testnet? 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or it might have been to make sure that testnet was returned when calling get with a key value. The ordering of adding the network should make that unnecessary, though.

I'm fine if you want to remove the indexBy to make the libs more uniform.

packages/bitcore-wallet-service/src/lib/common/utils.ts Outdated Show resolved Hide resolved
packages/bitcore-wallet-service/src/lib/chain/btc/index.ts Outdated Show resolved Hide resolved
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

2 participants