snapshot: add Unlock before return (#20948)

* Forget Unlock in snapshot

* Remove Unlock before panic
This commit is contained in:
Boqin Qin 2020-04-21 16:11:38 +08:00 committed by GitHub
parent 79b68dd78d
commit 7599999dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,7 @@ func (it *diffAccountIterator) Account() []byte {
blob, ok := it.layer.accountData[it.curHash] blob, ok := it.layer.accountData[it.curHash]
if !ok { if !ok {
if _, ok := it.layer.destructSet[it.curHash]; ok { if _, ok := it.layer.destructSet[it.curHash]; ok {
it.layer.lock.RUnlock()
return nil return nil
} }
panic(fmt.Sprintf("iterator referenced non-existent account: %x", it.curHash)) panic(fmt.Sprintf("iterator referenced non-existent account: %x", it.curHash))