native: optimize GAS onPersist for empty blocks

There is no need to get a list of validators when there are no transactions in
the block.
This commit is contained in:
Roman Khimov 2020-06-18 21:51:29 +03:00
parent f0fbb2d8ff
commit dd6895b103

View file

@ -80,6 +80,9 @@ func (g *GAS) Initialize(ic *interop.Context) error {
// OnPersist implements Contract interface.
func (g *GAS) OnPersist(ic *interop.Context) error {
if len(ic.Block.Transactions) == 0 {
return nil
}
for _, tx := range ic.Block.Transactions {
absAmount := big.NewInt(int64(tx.SystemFee + tx.NetworkFee))
g.burn(ic, tx.Sender, absAmount)