From 1e5825c4af8b6b441e2b8aa43173e116f72e8ff8 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 3 Jun 2022 23:39:46 +0300 Subject: [PATCH] core: don't allocate another int for notification handler It'll be serialized anyway. --- pkg/core/blockchain.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 1f881156b..c50e29584 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1365,6 +1365,7 @@ func (bc *Blockchain) processTokenTransfer(cache *dao.Simple, transCache map[uti if !isNEP11 { nep17xfer = &state.NEP17Transfer{ Asset: id, + Amount: *amount, From: from, To: to, Block: b.Index, @@ -1376,6 +1377,7 @@ func (bc *Blockchain) processTokenTransfer(cache *dao.Simple, transCache map[uti nep11xfer := &state.NEP11Transfer{ NEP17Transfer: state.NEP17Transfer{ Asset: id, + Amount: *amount, From: from, To: to, Block: b.Index, @@ -1388,13 +1390,14 @@ func (bc *Blockchain) processTokenTransfer(cache *dao.Simple, transCache map[uti nep17xfer = &nep11xfer.NEP17Transfer } if !from.Equals(util.Uint160{}) { - _ = nep17xfer.Amount.Neg(amount) // We already have the Int. - if appendTokenTransfer(cache, transCache, from, transfer, id, b.Index, b.Timestamp, isNEP11) != nil { + _ = nep17xfer.Amount.Neg(&nep17xfer.Amount) + err := appendTokenTransfer(cache, transCache, from, transfer, id, b.Index, b.Timestamp, isNEP11) + _ = nep17xfer.Amount.Neg(&nep17xfer.Amount) + if err != nil { return } } if !to.Equals(util.Uint160{}) { - _ = nep17xfer.Amount.Set(amount) // We already have the Int. _ = appendTokenTransfer(cache, transCache, to, transfer, id, b.Index, b.Timestamp, isNEP11) // Nothing useful we can do. } }