Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.
This repository was 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

Description

@gpip

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions