From 05118e96f4d1d89adbfbfdfb509c7e3602507a4f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 28 Sep 2020 15:28:59 +0300 Subject: [PATCH] native: store cache during Oracle contract creation `Initialize` is not called during restore from dump. --- pkg/core/native/oracle.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/core/native/oracle.go b/pkg/core/native/oracle.go index 5d3bd5a6e..2fa59cb02 100644 --- a/pkg/core/native/oracle.go +++ b/pkg/core/native/oracle.go @@ -130,6 +130,9 @@ func newOracle() *Oracle { md = newMethodAndPrice(getOnPersistWrapper(pp), 0, smartcontract.AllowModifyStates) o.AddMethod(md, desc, false) + o.nodes.Store(keys.PublicKeys(nil)) + o.nodesChanged.Store(false) + return o } @@ -199,8 +202,6 @@ func (o *Oracle) Initialize(ic *interop.Context) error { if err := ic.DAO.PutStorageItem(o.ContractID, prefixNodeList, si); err != nil { return err } - o.nodes.Store(keys.PublicKeys(nil)) - o.nodesChanged.Store(false) si = &state.StorageItem{Value: make([]byte, 8)} // uint64(0) LE return ic.DAO.PutStorageItem(o.ContractID, prefixRequestID, si) }