Merge pull request #648 from braydonf/ref/default-networks
Networks: Consistency of network reference and fix hardcoded value
This commit is contained in:
commit
3fc12e87d7
|
@ -233,6 +233,7 @@ Address._transformString = function(data, network, type){
|
|||
*/
|
||||
Address.fromPublicKey = function(data, network){
|
||||
var info = Address._transformPublicKey(data);
|
||||
network = network || networks.defaultNetwork.name;
|
||||
return new Address(info.hashBuffer, network, info.type);
|
||||
};
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ PublicKey.prototype.toDER = function(compressed) {
|
|||
* @returns {Address} An address generated from the public key
|
||||
*/
|
||||
PublicKey.prototype.toAddress = function(network) {
|
||||
return Address.fromPublicKey(this, network || 'livenet');
|
||||
return Address.fromPublicKey(this, network);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -260,7 +260,7 @@ describe('PublicKey', function() {
|
|||
|
||||
it('should output this known mainnet address correctly', function() {
|
||||
var pk = new PublicKey('03c87bd0e162f26969da8509cafcb7b8c8d202af30b928c582e263dd13ee9a9781');
|
||||
var address = pk.toAddress('mainnet');
|
||||
var address = pk.toAddress('livenet');
|
||||
address.toString().should.equal('1A6ut1tWnUq1SEQLMr4ttDh24wcbJ5o9TT');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue