aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-05-20 06:11:41 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-05-20 06:11:41 +0800
commit79042223dc5f2ae5d4a2ed73d18907440a963093 (patch)
treea16ffae1a4d10045fab1c6d385e16f10df008455
parentb14ee6ce16c44b5ab5215380d51ffa919a5d0be3 (diff)
parent8dac28f2e3394934a621fc493a870c46078819ac (diff)
downloadgo-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar.gz
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar.bz2
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar.lz
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar.xz
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.tar.zst
go-tangerine-79042223dc5f2ae5d4a2ed73d18907440a963093.zip
Merge pull request #1044 from obscuren/thread_safe_block_cache
core: block cache Has method thread safe
-rw-r--r--core/block_cache.go3
1 files changed, 3 insertions, 0 deletions
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
}