core,dao: implement Block-level storage caching

The order in which storage.Find items are returns depends on what items
were processed in previous transactions of the same block.
The easiest way to implement this sort of caching is to cache operations
with storage, flushing the only in `Persist()`.
This commit is contained in:
Evgenii Stratonikov 2020-05-06 14:34:17 +03:00
parent f0abbfd399
commit b96fe8173c
6 changed files with 246 additions and 20 deletions

View file

@ -561,8 +561,8 @@ func (ic *interopContext) contractDestroy(v *vm.VM) error {
if err != nil {
return err
}
for k := range siMap {
_ = ic.dao.DeleteStorageItem(hash, []byte(k))
for i := range siMap {
_ = ic.dao.DeleteStorageItem(hash, siMap[i].Key)
}
}
return nil