vm: copy argument in unary opcodes, fix #2051

We already do this in binary opcodes, let's be consistent.

This fixes state difference at height 275663
for tx 3c498317684d63849b03e4c58ad57ce4b19bb206b7b01bcc64233de3b3e207f4

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-07-08 14:07:02 +03:00
parent ea9dde257c
commit 1863023e27
2 changed files with 15 additions and 3 deletions

View file

@ -831,7 +831,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
// inplace
e := v.estack.Peek(0)
i := e.BigInt()
e.value = stackitem.Make(i.Not(i))
e.value = stackitem.Make(new(big.Int).Not(i))
case opcode.AND:
b := v.estack.Pop().BigInt()
@ -866,11 +866,11 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
case opcode.ABS:
x := v.estack.Pop().BigInt()
v.estack.PushVal(x.Abs(x))
v.estack.PushVal(new(big.Int).Abs(x))
case opcode.NEGATE:
x := v.estack.Pop().BigInt()
v.estack.PushVal(x.Neg(x))
v.estack.PushVal(new(big.Int).Neg(x))
case opcode.INC:
x := v.estack.Pop().BigInt()