From 8ff86bad6e4ba03919d84a5a1887fcd46e557b20 Mon Sep 17 00:00:00 2001 From: zjubfd <296179868@qq.com> Date: Sat, 2 Apr 2022 10:58:47 +0800 Subject: [PATCH] fix deadlock when failed to verify state root --- core/state/statedb.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 2621907f6c..2cdd757a22 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1415,14 +1415,15 @@ func (s *StateDB) Commit(failPostCommitFunc func(), postCommitFuncs ...func() er if s.pipeCommit { if commitErr == nil { s.snaps.Snapshot(s.stateRoot).MarkValid() + close(verified) } else { // The blockchain will do the further rewind if write block not finish yet + close(verified) if failPostCommitFunc != nil { failPostCommitFunc() } log.Error("state verification failed", "err", commitErr) } - close(verified) } return commitErr }