updated naming for getMultiSigInfo
This commit is contained in:
parent
e301a14657
commit
4860b8f3c7
|
@ -193,21 +193,21 @@ Script.prototype.getMultiSigInfo = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var nsigs = this.chunks[0] - 80; //see OP_2-OP_16;
|
var nsigs = this.chunks[0] - 80; //see OP_2-OP_16;
|
||||||
var npks = this.chunks[this.chunks.length - 2] - 80; //see OP_2-OP_16;
|
var npubkeys = this.chunks[this.chunks.length - 2] - 80; //see OP_2-OP_16;
|
||||||
|
|
||||||
var pks = [];
|
var pubkeys = [];
|
||||||
for (var i = 1; i < this.chunks.length - 2; i++) {
|
for (var i = 1; i < this.chunks.length - 2; i++) {
|
||||||
pks.push(this.chunks[i]);
|
pubkeys.push(this.chunks[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pks.length != npks) {
|
if (pubkeys.length != npubkeys) {
|
||||||
throw new Error("Script.getMultiSigInfo(): Amount of PKs does not match what the script specifies.");
|
throw new Error("Script.getMultiSigInfo(): Amount of PKs does not match what the script specifies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nsigs : nsigs,
|
nsigs : nsigs,
|
||||||
npks : npks,
|
npubkeys : npubkeys,
|
||||||
pks : pks
|
pubkeys : pubkeys
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,11 @@ describe('Script', function() {
|
||||||
var info = script.getMultiSigInfo();
|
var info = script.getMultiSigInfo();
|
||||||
|
|
||||||
info.nsigs.should.equal(3);
|
info.nsigs.should.equal(3);
|
||||||
info.npks.should.equal(5);
|
info.npubkeys.should.equal(5);
|
||||||
|
|
||||||
info.pks.length.should.equal(info.npks);
|
info.pubkeys.length.should.equal(info.npubkeys);
|
||||||
info.pks.map(function(pk) {
|
info.pubkeys.map(function(pubkey) {
|
||||||
testPubKeysHex.indexOf(pk.toString('hex')).should.not.equal(-1);
|
testPubKeysHex.indexOf(pubkey.toString('hex')).should.not.equal(-1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue