more address stuff.
This commit is contained in:
parent
5c5ff9e265
commit
718ae3c1aa
@ -52,23 +52,12 @@ function Address(options) {
|
||||
*/
|
||||
|
||||
Address.prototype.fromOptions = function fromOptions(options) {
|
||||
assert(options.hash);
|
||||
|
||||
this.hash = options.hash;
|
||||
|
||||
if (options.type)
|
||||
this.type = options.type;
|
||||
|
||||
if (options.version != null)
|
||||
this.version = options.version;
|
||||
|
||||
if (options.network)
|
||||
this.network = bcoin.network.get(options.network).type;
|
||||
|
||||
if (typeof this.hash === 'string')
|
||||
this.hash = new Buffer(this.hash, 'hex');
|
||||
|
||||
return this;
|
||||
return this.fromHash(
|
||||
options.hash,
|
||||
options.type,
|
||||
options.version,
|
||||
options.network
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -380,6 +369,8 @@ Address.prototype.fromHash = function fromHash(hash, type, version, network) {
|
||||
if (typeof hash === 'string')
|
||||
hash = new Buffer(hash, 'hex');
|
||||
|
||||
assert(Buffer.isBuffer(hash));
|
||||
|
||||
if (!type)
|
||||
type = 'pubkeyhash';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user