diff options
author | aaronbuchwald <[email protected]> | 2020-09-17 09:36:44 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-09-17 09:36:44 -0400 |
commit | 42ee77a946d062a4c8e1fabc394ac016ae30e68e (patch) | |
tree | 85da01f5b75788e257d3c355917a4b3a8ad8603b /core/blockchain.go | |
parent | 92fdc0a4b6208387424029182a131b25a2f92dac (diff) | |
parent | 6b4efa7ff5537a7cdb1d73b18dd75f56bdadc032 (diff) |
Merge pull request #33 from ava-labs/fix-nil-pointer
Fix potential nil pointer dereference
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index b3a7ffa..82e3b6c 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2492,13 +2492,12 @@ func (bc *BlockChain) SubscribeBlockProcessingEvent(ch chan<- bool) event.Subscr } func (bc *BlockChain) ManualHead(hash common.Hash) error { - return bc.FastSyncCommitHead(hash) - //block := bc.GetBlockByHash(hash) - //if block == nil { - // return errors.New("block not found") - //} - //bc.chainmu.Lock() - //defer bc.chainmu.Unlock() - //bc.writeHeadBlock(block) - //return nil + block := bc.GetBlockByHash(hash) + if block == nil { + return errors.New("block not found") + } + bc.chainmu.Lock() + defer bc.chainmu.Unlock() + bc.writeHeadBlock(block) + return nil } |