further simplify use of bignum in Transaction and ScriptInterpreter
This commit is contained in:
parent
823d02118c
commit
c75de967fd
@ -494,14 +494,14 @@ ScriptInterpreter.prototype.eval = function eval(script, tx, inIndex, hashType,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Opcode.map.OP_LSHIFT:
|
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");
|
throw new Error("OP_LSHIFT parameter out of bounds");
|
||||||
}
|
}
|
||||||
num = v1.shiftLeft(v2);
|
num = v1.shiftLeft(v2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Opcode.map.OP_RSHIFT:
|
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");
|
throw new Error("OP_RSHIFT parameter out of bounds");
|
||||||
}
|
}
|
||||||
num = v1.shiftRight(v2);
|
num = v1.shiftRight(v2);
|
||||||
|
|||||||
@ -512,7 +512,7 @@ Transaction.prototype.fromObj = function fromObj(obj) {
|
|||||||
var addr = new Address(addrStr);
|
var addr = new Address(addrStr);
|
||||||
var script = Script.createPubKeyHashOut(addr.payload());
|
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 value = util.bigIntToValue(valueNum);
|
||||||
|
|
||||||
var txout = new TransactionOut();
|
var txout = new TransactionOut();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user