From 2808f6857dbeaa92b30be827e881e7399d153f79 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 20 Aug 2021 11:56:28 +0300 Subject: [PATCH] interop: don't allocate for Functions and Notifications in New Functions are usually immediately replaced (and it's OK for them to be nil, searching through an array with length of zero is fine), Notifications are usually appended to (and are absolutely useless in verification contexts). --- pkg/core/interop/context.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/pkg/core/interop/context.go b/pkg/core/interop/context.go index 0160c9b1e..7c9ab541d 100644 --- a/pkg/core/interop/context.go +++ b/pkg/core/interop/context.go @@ -57,23 +57,19 @@ func NewContext(trigger trigger.Type, bc blockchainer.Blockchainer, d dao.DAO, block *block.Block, tx *transaction.Transaction, log *zap.Logger) *Context { baseExecFee := int64(DefaultBaseExecFee) dao := d.GetWrapped() - nes := make([]state.NotificationEvent, 0) if bc != nil && (block == nil || block.Index != 0) { baseExecFee = bc.GetPolicer().GetBaseExecFee() } return &Context{ - Chain: bc, - Network: uint32(bc.GetConfig().Magic), - Natives: natives, - Trigger: trigger, - Block: block, - Tx: tx, - DAO: dao, - Notifications: nes, - Log: log, - // Functions is a slice of interops sorted by ID. - Functions: []Function{}, + Chain: bc, + Network: uint32(bc.GetConfig().Magic), + Natives: natives, + Trigger: trigger, + Block: block, + Tx: tx, + DAO: dao, + Log: log, getContract: getContract, baseExecFee: baseExecFee, }