core: only save token logs if there is something to save

Makes no sense storing empty ones.
This commit is contained in:
Roman Khimov 2021-11-16 23:16:54 +03:00
parent f3278ea5b2
commit b622c1934d

View file

@ -1010,17 +1010,21 @@ func (bc *Blockchain) storeBlock(block *block.Block, txpool *mempool.Pool) error
aerdone <- err aerdone <- err
return return
} }
if !trData.Info.NewNEP11Batch {
err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP11Batch, true, &trData.Log11) err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP11Batch, true, &trData.Log11)
if err != nil { if err != nil {
aerdone <- err aerdone <- err
return return
} }
}
if !trData.Info.NewNEP17Batch {
err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP17Batch, false, &trData.Log17) err = kvcache.PutTokenTransferLog(acc, trData.Info.NextNEP17Batch, false, &trData.Log17)
if err != nil { if err != nil {
aerdone <- err aerdone <- err
return return
} }
} }
}
close(aerdone) close(aerdone)
}() }()
aer, err := bc.runPersist(bc.contracts.GetPersistScript(), block, cache, trigger.OnPersist) aer, err := bc.runPersist(bc.contracts.GetPersistScript(), block, cache, trigger.OnPersist)