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.

Throw when invalid network string is passed in #32

Description

@gabegattis

In some cases, we pass in a network as a string to specify the network of some other argument. An example is creating an address

var bitcore = require('bitcore-lib');
var myAddress = bitcore.Address.fromString('135zDqhbNcmPk3gbyeJmH75yiLdVZechsK', 'livenet');

but I can pass in an invalid network string and it will silently default to livenet instead of throwing

var myOtherAddress = bitcore.Address.fromString('135zDqhbNcmPk3gbyeJmH75yiLdVZechsK', 'derpnet');
console.log(myOtherAddress); // <Address: 135zDqhbNcmPk3gbyeJmH75yiLdVZechsK, type: pubkeyhash, network: livenet>

We should probably throw an error if an invalid network string gets passed in to functions like this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions