From f8477e29ab09162c81fe9440590755bc6e0e9d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horacio=20Mijail=20Ant=C3=B3n=20Quiles?= <4139546+hmijail@users.noreply.github.com> Date: Fri, 30 Oct 2020 18:41:35 +1000 Subject: [PATCH] Move batch management into the writeReceipts case (#1321) --- cmd/state/stateless/check_change_sets.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/state/stateless/check_change_sets.go b/cmd/state/stateless/check_change_sets.go index d0c58e61e..43c4bef51 100644 --- a/cmd/state/stateless/check_change_sets.go +++ b/cmd/state/stateless/check_change_sets.go @@ -95,11 +95,11 @@ func CheckChangeSets(genesis *core.Genesis, blockNum uint64, chaindata string, h if err := rawdb.WriteReceipts(batch, block.NumberU64(), receipts); err != nil { return err } - } - if batch.BatchSize() >= batch.IdealBatchSize() { - log.Info("Committing receipts", "up to block", block.NumberU64(), "batch size", common.StorageSize(batch.BatchSize())) - if err := batch.CommitAndBegin(context.Background()); err != nil { - return err + if batch.BatchSize() >= batch.IdealBatchSize() { + log.Info("Committing receipts", "up to block", block.NumberU64(), "batch size", common.StorageSize(batch.BatchSize())) + if err := batch.CommitAndBegin(context.Background()); err != nil { + return err + } } }