From e6e8761d3565750a0584edff1aff092ba626ca44 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 16 Mar 2020 11:52:09 +0300 Subject: [PATCH] core: fix contract's state migration and don't swallow errors Fixes difference in state changes at mainnet's block 2442790 because contract migration in b4eb2dc35226e6520ee4e09a56197dff91547b50a7f57edc82930fc18c75dffc doesn't actually transfer the storage state, it only deletes the old one. And add an error check just in case. --- pkg/core/interop_neo.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/core/interop_neo.go b/pkg/core/interop_neo.go index b0d0760c6..fcb4843ff 100644 --- a/pkg/core/interop_neo.go +++ b/pkg/core/interop_neo.go @@ -579,7 +579,10 @@ func (ic *interopContext) contractMigrate(v *vm.VM) error { } for k, v := range siMap { v.IsConst = false - _ = ic.dao.PutStorageItem(hash, []byte(k), v) + err = ic.dao.PutStorageItem(contract.ScriptHash(), []byte(k), v) + if err != nil { + return err + } } } }