diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-19 23:52:44 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-20 03:50:56 +0800 |
commit | 8dac28f2e3394934a621fc493a870c46078819ac (patch) | |
tree | 394f953de4d3a284b0ecf0ac6da4bdc72e121e26 | |
parent | 87a05c8f38dd34728e4375dee51fcd20da1048ec (diff) | |
download | go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar.gz go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar.bz2 go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar.lz go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar.xz go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.tar.zst go-tangerine-8dac28f2e3394934a621fc493a870c46078819ac.zip |
core: block cache Has method thread safe
-rw-r--r-- | core/block_cache.go | 3 |
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 } |