core: don't allocate another int for notification handler

It'll be serialized anyway.
This commit is contained in:
Roman Khimov 2022-06-03 23:39:46 +03:00
parent e5c8d6278b
commit 1e5825c4af

View file

@ -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.
}
}