interop: use non-Cached wrapped DAO

Cached only caches NEP-17 tracking data now, it makes no sense here.
This commit is contained in:
Roman Khimov 2021-07-29 22:33:53 +03:00
parent fa7314ea90
commit 3cebd2b129
2 changed files with 4 additions and 4 deletions

View file

@ -42,7 +42,7 @@ type Context struct {
Block *block.Block Block *block.Block
NonceData [16]byte NonceData [16]byte
Tx *transaction.Transaction Tx *transaction.Transaction
DAO *dao.Cached DAO dao.DAO
Notifications []state.NotificationEvent Notifications []state.NotificationEvent
Log *zap.Logger Log *zap.Logger
VM *vm.VM VM *vm.VM
@ -54,7 +54,7 @@ type Context struct {
func NewContext(trigger trigger.Type, bc blockchainer.Blockchainer, d dao.DAO, func NewContext(trigger trigger.Type, bc blockchainer.Blockchainer, d dao.DAO,
getContract func(dao.DAO, util.Uint160) (*state.Contract, error), natives []Contract, getContract func(dao.DAO, util.Uint160) (*state.Contract, error), natives []Contract,
block *block.Block, tx *transaction.Transaction, log *zap.Logger) *Context { block *block.Block, tx *transaction.Transaction, log *zap.Logger) *Context {
dao := dao.NewCached(d) dao := d.GetWrapped()
nes := make([]state.NotificationEvent, 0) nes := make([]state.NotificationEvent, 0)
return &Context{ return &Context{
Chain: bc, Chain: bc,

View file

@ -180,7 +180,7 @@ func getBlockHashFromItem(bc blockchainer.Blockchainer, item stackitem.Item) uti
// getTransactionAndHeight returns transaction and its height if it's present // getTransactionAndHeight returns transaction and its height if it's present
// on the chain. It panics if anything goes wrong. // on the chain. It panics if anything goes wrong.
func getTransactionAndHeight(cd *dao.Cached, item stackitem.Item) (*transaction.Transaction, uint32, error) { func getTransactionAndHeight(d dao.DAO, item stackitem.Item) (*transaction.Transaction, uint32, error) {
hashbytes, err := item.TryBytes() hashbytes, err := item.TryBytes()
if err != nil { if err != nil {
panic(err) panic(err)
@ -189,7 +189,7 @@ func getTransactionAndHeight(cd *dao.Cached, item stackitem.Item) (*transaction.
if err != nil { if err != nil {
panic(err) panic(err)
} }
return cd.GetTransaction(hash) return d.GetTransaction(hash)
} }
// BlockToStackItem converts block.Block to stackitem.Item. // BlockToStackItem converts block.Block to stackitem.Item.