From 7d7480527e66650348926952bb0fe274e699f00d Mon Sep 17 00:00:00 2001 From: Nisen Date: Mon, 27 Apr 2020 19:20:09 +0800 Subject: [PATCH] Missing defer before unlock (#5643) * missing defer before unlock --- beacon-chain/state/getters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beacon-chain/state/getters.go b/beacon-chain/state/getters.go index b527afc2fe1..c4bfe245c78 100644 --- a/beacon-chain/state/getters.go +++ b/beacon-chain/state/getters.go @@ -451,7 +451,7 @@ func (b *BeaconState) ValidatorAtIndexReadOnly(idx uint64) (*ReadOnlyValidator, // ValidatorIndexByPubkey returns a given validator by its 48-byte public key. func (b *BeaconState) ValidatorIndexByPubkey(key [48]byte) (uint64, bool) { b.lock.RLock() - b.lock.RUnlock() + defer b.lock.RUnlock() idx, ok := b.valIdxMap[key] return idx, ok }