From 7599999dcd966843a08a79529470d15e77139ce0 Mon Sep 17 00:00:00 2001
From: Boqin Qin <Bobbqqin@gmail.com>
Date: Tue, 21 Apr 2020 16:11:38 +0800
Subject: [PATCH] snapshot: add Unlock before return (#20948)

* Forget Unlock in snapshot

* Remove Unlock before panic
---
 core/state/snapshot/iterator.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/core/state/snapshot/iterator.go b/core/state/snapshot/iterator.go
index 84cc5c3bc..e6a0cd947 100644
--- a/core/state/snapshot/iterator.go
+++ b/core/state/snapshot/iterator.go
@@ -125,6 +125,7 @@ func (it *diffAccountIterator) Account() []byte {
 	blob, ok := it.layer.accountData[it.curHash]
 	if !ok {
 		if _, ok := it.layer.destructSet[it.curHash]; ok {
+			it.layer.lock.RUnlock()
 			return nil
 		}
 		panic(fmt.Sprintf("iterator referenced non-existent account: %x", it.curHash))
-- 
GitLab