Fixes for Script.getInType and Script.simpleInPubKey.
This commit is contained in:
parent
1a7fc9d063
commit
de21042bb7
1 changed files with 6 additions and 3 deletions
|
@ -99,15 +99,16 @@
|
||||||
|
|
||||||
Script.prototype.getInType = function ()
|
Script.prototype.getInType = function ()
|
||||||
{
|
{
|
||||||
if (this.chunks.length == 1) {
|
if (this.chunks.length == 1 &&
|
||||||
|
Bitcoin.Util.isArray(this.chunks[0])) {
|
||||||
// Direct IP to IP transactions only have the public key in their scriptSig.
|
// Direct IP to IP transactions only have the public key in their scriptSig.
|
||||||
|
// TODO: We could also check that the length of the data is 65 or 33.
|
||||||
return 'Pubkey';
|
return 'Pubkey';
|
||||||
} else if (this.chunks.length == 2 &&
|
} else if (this.chunks.length == 2 &&
|
||||||
Bitcoin.Util.isArray(this.chunks[0]) &&
|
Bitcoin.Util.isArray(this.chunks[0]) &&
|
||||||
Bitcoin.Util.isArray(this.chunks[1])) {
|
Bitcoin.Util.isArray(this.chunks[1])) {
|
||||||
return 'Address';
|
return 'Address';
|
||||||
} else {
|
} else {
|
||||||
console.log(this.chunks);
|
|
||||||
throw new Error("Encountered non-standard scriptSig");
|
throw new Error("Encountered non-standard scriptSig");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -118,7 +119,9 @@
|
||||||
case 'Address':
|
case 'Address':
|
||||||
return this.chunks[1];
|
return this.chunks[1];
|
||||||
case 'Pubkey':
|
case 'Pubkey':
|
||||||
return this.chunks[0];
|
// TODO: Theoretically, we could recover the pubkey from the sig here.
|
||||||
|
// See https://bitcointalk.org/?topic=6430.0
|
||||||
|
throw new Error("Script does not contain pubkey.");
|
||||||
default:
|
default:
|
||||||
throw new Error("Encountered non-standard scriptSig");
|
throw new Error("Encountered non-standard scriptSig");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue