From ac7e922606175f4ea34fbaac87afd81ff82e8eb3 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 2 Dec 2021 15:40:43 +0300 Subject: [PATCH] native: avoid big.Int allocation in burn() addTokens and incBalance only read the amount, so it's not a problem. --- pkg/core/native/native_nep17.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/core/native/native_nep17.go b/pkg/core/native/native_nep17.go index ca5a5bc7d..0f88df1ad 100644 --- a/pkg/core/native/native_nep17.go +++ b/pkg/core/native/native_nep17.go @@ -262,7 +262,9 @@ func (c *nep17TokenNative) burn(ic *interop.Context, h util.Uint160, amount *big if amount.Sign() == 0 { return } - c.addTokens(ic, h, new(big.Int).Neg(amount)) + amount.Neg(amount) + c.addTokens(ic, h, amount) + amount.Neg(amount) c.postTransfer(ic, &h, nil, amount, stackitem.Null{}, false) }