diff options
author | Determinant <[email protected]> | 2020-08-20 12:09:32 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-08-20 12:09:32 -0400 |
commit | 726ad2214ca0a7e4d165838c531aa0d401524600 (patch) | |
tree | 1fb7a76d5caf01648525b864e94a3c720ee9a6ee /core | |
parent | cb5e141d930e0c245804fe87a2caf4962b8f3c5f (diff) | |
parent | 0d2a35293b7aa49d143ce215591104aba1c89388 (diff) |
Merge tag 'v0.2.8-rc.6' into ecstasy-transferv0.2.12
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 64c2451..6e316c7 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -732,6 +732,8 @@ func (bc *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { // GetBlockByHash retrieves a block from the database by hash, caching it if found. func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block { + bc.chainmu.Lock() + defer bc.chainmu.Unlock() number := bc.hc.GetBlockNumber(hash) if number == nil { return nil @@ -742,6 +744,8 @@ func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block { // GetBlockByNumber retrieves a block from the database by number, caching it // (associated with its hash) if found. func (bc *BlockChain) GetBlockByNumber(number uint64) *types.Block { + bc.chainmu.Lock() + defer bc.chainmu.Unlock() hash := rawdb.ReadCanonicalHash(bc.db, number) if hash == (common.Hash{}) { return nil |