core: add InitializeCache method to Contract interface

Make the contracts cache initialization unified. The order of cache
iniitialization is not important and Nottary contract is added to the
bc.contracts.Contracts wrt P2PSigExtensions setting, thus no functional
changes, just refactoring for future applications.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-04-26 12:52:59 +03:00
parent 29b3df10b6
commit 33c971b0e4
13 changed files with 40 additions and 28 deletions

View file

@ -251,10 +251,11 @@ func (o *Oracle) Initialize(ic *interop.Context) error {
return nil
}
func (o *Oracle) InitializeCache(d *dao.Simple) {
func (o *Oracle) InitializeCache(blockHeight uint32, d *dao.Simple) error {
cache := &OracleCache{}
cache.requestPrice = getIntWithKey(o.ID, d, prefixRequestPrice)
d.SetCache(o.ID, cache)
return nil
}
func getResponse(tx *transaction.Transaction) *transaction.OracleResponse {