Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

bitcore-lib gets confused when more than one network uses the same xpriv bytes #131

Open
gpip opened this issue Mar 27, 2017 · 1 comment

Comments

@gpip
Copy link

gpip commented Mar 27, 2017

Hello,

When adding a network that shares the same xpriv bytes as another, HDPrivateKey will return the incorrect network because it bases its decision only on those bytes. Should it store the actual network used instead? Maybe the network name?

> var b = require('bitcore-lib');
> var c = require('coininfo');
> var dashmain = c.dash.main.toBitcore();
> dashmain.name = 'dash';
> dashmain.alias = 'dashmainnet';
> b.Networks.add(dashmain);
> b.HDPrivateKey('dash').network
'dash'  # OK
> b.HDPrivateKey(b.Networks.mainnet).network
'dash'  # FAIL

Without modifying:

> var b = require('bitcore-lib');
> b.HDPrivateKey(b.Networks.mainnet).network.name
'livenet'  # OK
@priestc
Copy link

priestc commented Jun 24, 2017

#145 may fix this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@priestc @gpip and others