interop: move invocation counter from VM to Context

It's created for interop and used by interop, VM doesn't care.
This commit is contained in:
Roman Khimov 2021-11-19 20:25:58 +03:00
parent 29cda5112a
commit 83d0b2f465
6 changed files with 8 additions and 10 deletions

View file

@ -63,10 +63,10 @@ func GetNotifications(ic *interop.Context) error {
// GetInvocationCounter returns how many times current contract was invoked during current tx execution.
func GetInvocationCounter(ic *interop.Context) error {
currentScriptHash := ic.VM.GetCurrentScriptHash()
count, ok := ic.VM.Invocations[currentScriptHash]
count, ok := ic.Invocations[currentScriptHash]
if !ok {
count = 1
ic.VM.Invocations[currentScriptHash] = count
ic.Invocations[currentScriptHash] = count
}
ic.VM.Estack().PushItem(stackitem.NewBigInteger(big.NewInt(int64(count))))
return nil