Browse Source

further simplify use of bignum in Transaction and ScriptInterpreter

patch-2
Ryan X. Charles 11 years ago
parent
commit
c75de967fd
  1. 4
      lib/ScriptInterpreter.js
  2. 2
      lib/Transaction.js

4
lib/ScriptInterpreter.js

@ -494,14 +494,14 @@ ScriptInterpreter.prototype.eval = function eval(script, tx, inIndex, hashType,
break;
case Opcode.map.OP_LSHIFT:
if (v2.cmp(0) < 0 || v2.cmp(bignum(2048)) > 0) {
if (v2.cmp(0) < 0 || v2.cmp(2048) > 0) {
throw new Error("OP_LSHIFT parameter out of bounds");
}
num = v1.shiftLeft(v2);
break;
case Opcode.map.OP_RSHIFT:
if (v2.cmp(0) < 0 || v2.cmp(bignum(2048)) > 0) {
if (v2.cmp(0) < 0 || v2.cmp(2048) > 0) {
throw new Error("OP_RSHIFT parameter out of bounds");
}
num = v1.shiftRight(v2);

2
lib/Transaction.js

@ -512,7 +512,7 @@ Transaction.prototype.fromObj = function fromObj(obj) {
var addr = new Address(addrStr);
var script = Script.createPubKeyHashOut(addr.payload());
var valueNum = new bignum(obj.outputs[addrStr]);
var valueNum = bignum(obj.outputs[addrStr]);
var value = util.bigIntToValue(valueNum);
var txout = new TransactionOut();

Loading…
Cancel
Save