mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 03:58:06 +00:00
Merge pull request #542 from nspcc-dev/fix-storage-interop-reads
core: fix wrong data being read in interops (part of #501)
This commit is contained in:
commit
8beb135829
1 changed files with 1 additions and 10 deletions
|
@ -411,9 +411,6 @@ func (ic *interopContext) storageDelete(v *vm.VM) error {
|
|||
}
|
||||
key := v.Estack().Pop().Bytes()
|
||||
si := getStorageItemFromStore(ic.mem, stc.ScriptHash, key)
|
||||
if si == nil {
|
||||
si = ic.bc.GetStorageItem(stc.ScriptHash, key)
|
||||
}
|
||||
if si != nil && si.IsConst {
|
||||
return errors.New("storage item is constant")
|
||||
}
|
||||
|
@ -433,9 +430,6 @@ func (ic *interopContext) storageGet(v *vm.VM) error {
|
|||
}
|
||||
key := v.Estack().Pop().Bytes()
|
||||
si := getStorageItemFromStore(ic.mem, stc.ScriptHash, key)
|
||||
if si == nil {
|
||||
si = ic.bc.GetStorageItem(stc.ScriptHash, key)
|
||||
}
|
||||
if si != nil && si.Value != nil {
|
||||
v.Estack().PushVal(si.Value)
|
||||
} else {
|
||||
|
@ -480,10 +474,7 @@ func (ic *interopContext) putWithContextAndFlags(stc *StorageContext, key []byte
|
|||
}
|
||||
si := getStorageItemFromStore(ic.mem, stc.ScriptHash, key)
|
||||
if si == nil {
|
||||
si = ic.bc.GetStorageItem(stc.ScriptHash, key)
|
||||
if si == nil {
|
||||
si = &StorageItem{}
|
||||
}
|
||||
si = &StorageItem{}
|
||||
}
|
||||
if si.IsConst {
|
||||
return errors.New("storage item exists and is read-only")
|
||||
|
|
Loading…
Reference in a new issue