diff --git a/pkg/core/interop/context.go b/pkg/core/interop/context.go index 59b2337b0..61e56ad59 100644 --- a/pkg/core/interop/context.go +++ b/pkg/core/interop/context.go @@ -27,6 +27,7 @@ type Context struct { Block *block.Block Tx *transaction.Transaction DAO *dao.Cached + LowerDAO dao.DAO Notifications []state.NotificationEvent Log *zap.Logger } @@ -42,6 +43,7 @@ func NewContext(trigger trigger.Type, bc blockchainer.Blockchainer, d dao.DAO, n Block: block, Tx: tx, DAO: dao, + LowerDAO: d, Notifications: nes, Log: log, } diff --git a/pkg/core/interop_system.go b/pkg/core/interop_system.go index 4f6bfea4b..b6dc95aa6 100644 --- a/pkg/core/interop_system.go +++ b/pkg/core/interop_system.go @@ -537,8 +537,12 @@ func contractGetStorageContext(ic *interop.Context, v *vm.VM) error { if !ok { return fmt.Errorf("%T is not a contract state", cs) } - contractState, err := ic.DAO.GetContractState(cs.ScriptHash()) - if contractState == nil || err != nil { + _, err := ic.DAO.GetContractState(cs.ScriptHash()) + if err != nil { + return fmt.Errorf("non-existent contract") + } + _, err = ic.LowerDAO.GetContractState(cs.ScriptHash()) + if err == nil { return fmt.Errorf("contract was not created in this transaction") } stc := &StorageContext{