From b305f541a4c2aada90d033931f479dce141ac49b Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 3 Oct 2023 13:02:54 +0800 Subject: [PATCH] deferred rollback --- pkg/service.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/service.go b/pkg/service.go index 6785079..6add701 100644 --- a/pkg/service.go +++ b/pkg/service.go @@ -404,6 +404,7 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p if err != nil { return err } + defer tx.RollbackOnFailure(err) // defer handling of commit/rollback for any return case output := func(node sdtypes.StateLeafNode) error { return sds.indexer.PushStateNode(tx, node, block.Hash().String())