fix coins parsing. address type.

This commit is contained in:
Christopher Jeffrey 2016-06-24 12:54:49 -07:00
parent 5cce4539d1
commit 2a18a76973
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -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.');
};
/**