From 8dac28f2e3394934a621fc493a870c46078819ac Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 19 May 2015 17:52:44 +0200 Subject: [PATCH] core: block cache Has method thread safe --- core/block_cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/block_cache.go b/core/block_cache.go index eeef5c41d..0c747d37c 100644 --- a/core/block_cache.go +++ b/core/block_cache.go @@ -85,6 +85,9 @@ func (bc *BlockCache) Get(hash common.Hash) *types.Block { } func (bc *BlockCache) Has(hash common.Hash) bool { + bc.mu.RLock() + defer bc.mu.RUnlock() + _, ok := bc.blocks[hash] return ok }