From b622c1934dc459f5cb9c60ab5f7ec424296f5fce Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 16 Nov 2021 23:16:54 +0300 Subject: [PATCH] core: only save token logs if there is something to save Makes no sense storing empty ones. --- pkg/core/blockchain.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index bc519e1cd..0745794e6 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1010,15 +1010,19 @@ func (bc *Blockchain) storeBlock(block *block.Block, txpool *mempool.Pool) error aerdone <- err return } - err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP11Batch, true, &trData.Log11) - if err != nil { - aerdone <- err - return + if !trData.Info.NewNEP11Batch { + err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP11Batch, true, &trData.Log11) + if err != nil { + aerdone <- err + return + } } - err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP17Batch, false, &trData.Log17) - if err != nil { - aerdone <- err - return + if !trData.Info.NewNEP17Batch { + err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP17Batch, false, &trData.Log17) + if err != nil { + aerdone <- err + return + } } } close(aerdone)