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
base: master
Are you sure you want to change the base?
Conversation
bfbc205
to
ecb7c5e
Compare
There was a problem hiding this 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-wallet-service/src/lib/pushnotificationsservice.ts
Outdated
Show resolved
Hide resolved
if(!_.isUndefined(networkValue) && !_.isObject(networkValue)) { | ||
if(!networkMaps[networkValue]) { | ||
networkMaps[networkValue] = []; | ||
for (const value of Object.values(network)) { |
There was a problem hiding this comment.
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) {
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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? 🤷
There was a problem hiding this comment.
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.
9865738
to
9be6ca2
Compare
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.