diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index 99579165f..2a3a2faa1 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -227,10 +227,13 @@ func (n *NEO) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey key := makeValidatorKey(pub) si := ic.DAO.GetStorageItem(n.ContractID, key) if si == nil { - si = new(state.StorageItem) + c := &candidate{Registered: true} + si = &state.StorageItem{Value: c.Bytes()} + } else { + c := new(candidate).FromBytes(si.Value) + c.Registered = true + si.Value = c.Bytes() } - c := &candidate{Registered: true} - si.Value = c.Bytes() return ic.DAO.PutStorageItem(n.ContractID, key, si) }