vm: use truncated division in MOD

Mimic C#'s `%` behavior.
Related 4b44190 (#773).
This commit is contained in:
Evgenii Stratonikov 2020-04-05 17:34:14 +03:00
parent c0b5271386
commit 0023c4f1f6
2 changed files with 17 additions and 9 deletions

View file

@ -794,7 +794,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
a := v.estack.Pop().BigInt()
v.checkBigIntSize(a)
v.estack.PushVal(new(big.Int).Mod(a, b))
v.estack.PushVal(new(big.Int).Rem(a, b))
case opcode.SHL, opcode.SHR:
b := v.estack.Pop().BigInt().Int64()