From 3094e7f3b8c4dc1567b84aa2a77e81cce117fa23 Mon Sep 17 00:00:00 2001
From: gary rong <garyrong0905@gmail.com>
Date: Thu, 3 Jun 2021 23:12:47 +0800
Subject: [PATCH] catalyst: runs every transaction in a snapshot in
 assembleBlock handler (#7) (#22989)

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Mikhail Kalinin <noblesse.knight@gmail.com>
---
 eth/catalyst/api.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go
index d577e2a9e..1e487d778 100644
--- a/eth/catalyst/api.go
+++ b/eth/catalyst/api.go
@@ -79,8 +79,10 @@ type blockExecutionEnv struct {
 
 func (env *blockExecutionEnv) commitTransaction(tx *types.Transaction, coinbase common.Address) error {
 	vmconfig := *env.chain.GetVMConfig()
+	snap := env.state.Snapshot()
 	receipt, err := core.ApplyTransaction(env.chain.Config(), env.chain, &coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, vmconfig)
 	if err != nil {
+		env.state.RevertToSnapshot(snap)
 		return err
 	}
 	env.txs = append(env.txs, tx)
-- 
GitLab