diff --git a/pkg/core/native/interop.go b/pkg/core/native/interop.go index f2f3684f1..00f0f3c73 100644 --- a/pkg/core/native/interop.go +++ b/pkg/core/native/interop.go @@ -18,30 +18,31 @@ func Call(ic *interop.Context) error { if version != 0 { return fmt.Errorf("native contract of version %d is not active", version) } - var c interop.Contract + var meta *interop.ContractMD curr := ic.VM.GetCurrentScriptHash() for _, ctr := range ic.Natives { - if ctr.Metadata().Hash == curr { - c = ctr + m := ctr.Metadata() + if m.Hash == curr { + meta = m break } } - if c == nil { + if meta == nil { return fmt.Errorf("native contract %s (version %d) not found", curr.StringLE(), version) } - history := c.Metadata().UpdateHistory + history := meta.UpdateHistory if len(history) == 0 { - return fmt.Errorf("native contract %s is disabled", c.Metadata().Name) + return fmt.Errorf("native contract %s is disabled", meta.Name) } if history[0] > ic.BlockHeight() { - return fmt.Errorf("native contract %s is active after height = %d", c.Metadata().Name, history[0]) + return fmt.Errorf("native contract %s is active after height = %d", meta.Name, history[0]) } - m, ok := c.Metadata().GetMethodByOffset(ic.VM.Context().IP()) + m, ok := meta.GetMethodByOffset(ic.VM.Context().IP()) if !ok { return fmt.Errorf("method not found") } reqFlags := m.RequiredFlags - if !ic.IsHardforkEnabled(config.HFAspidochelone) && c.Metadata().ID == ManagementContractID && + if !ic.IsHardforkEnabled(config.HFAspidochelone) && meta.ID == ManagementContractID && (m.MD.Name == "deploy" || m.MD.Name == "update") { reqFlags &= callflag.States | callflag.AllowNotify }