fix coins parsing. address type.
This commit is contained in:
parent
5cce4539d1
commit
2a18a76973
@ -234,6 +234,7 @@ Coins.prototype.fromRaw = function fromRaw(data, hash, index) {
|
||||
mask = p.readU8();
|
||||
|
||||
if (mask === 0xff) {
|
||||
p.end();
|
||||
if (index != null) {
|
||||
if (i === index)
|
||||
return;
|
||||
|
||||
@ -2531,6 +2531,9 @@ Script.fromAddress = function fromAddress(address) {
|
||||
if (typeof address === 'string')
|
||||
address = bcoin.address.fromBase58(address);
|
||||
|
||||
if (!address)
|
||||
throw new Error('Unknown address type.');
|
||||
|
||||
if (address.type === 'pubkeyhash')
|
||||
return Script.fromPubkeyhash(address.hash);
|
||||
|
||||
@ -2540,7 +2543,7 @@ Script.fromAddress = function fromAddress(address) {
|
||||
if (address.version !== -1)
|
||||
return Script.fromProgram(address.version, address.hash);
|
||||
|
||||
assert(false, 'Bad type.');
|
||||
assert(false, 'Bad address type.');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user