Merge pull request #1207 from maraoz/fix-p2sh-in

fix bug in recognizing p2sh input scripts
This commit is contained in:
Manuel Aráoz 2015-04-30 04:34:06 -03:00
commit 47ffca7f5c
2 changed files with 5 additions and 1 deletions

View File

@ -296,7 +296,7 @@ Script.prototype.isScriptHashOut = function() {
* Note that these are frequently indistinguishable from pubkeyhashin
*/
Script.prototype.isScriptHashIn = function() {
if (this.chunks.length === 0) {
if (this.chunks.length <= 1) {
return false;
}
var redeemChunk = this.chunks[this.chunks.length - 1];

View File

@ -322,6 +322,10 @@ describe('Script', function() {
s.isScriptHashIn().should.equal(false);
s2.isScriptHashIn().should.equal(false);
});
it('identifies this other problematic non-p2sh in', function() {
var s = Script.fromString('73 0x3046022100dc7a0a812de14acc479d98ae209402cc9b5e0692bc74b9fe0a2f083e2f9964b002210087caf04a711bebe5339fd7554c4f7940dc37be216a3ae082424a5e164faf549401');
s.isScriptHashIn().should.equal(false);
});
});
describe('#isScripthashOut', function() {