core: adjust System.Runtime.GasLeft interop

Part of #1055.

In test mode it should return -1.
This commit is contained in:
Anna Shaleva 2020-07-21 14:23:52 +03:00
parent 8fed383523
commit 990ef5525c

View file

@ -11,7 +11,11 @@ import (
// GasLeft returns remaining amount of GAS.
func GasLeft(_ *interop.Context, v *vm.VM) error {
v.Estack().PushVal(v.GasLimit - v.GasConsumed())
if v.GasLimit == -1 {
v.Estack().PushVal(v.GasLimit)
} else {
v.Estack().PushVal(v.GasLimit - v.GasConsumed())
}
return nil
}