reverted change on the core/blockchain.go

This commit is contained in:
Trung Nguyen 2018-10-05 16:28:10 -04:00
parent 4e22d13b10
commit 600852a5cb
No known key found for this signature in database
GPG Key ID: 4636434ED9505EB7
1 changed files with 3 additions and 14 deletions

View File

@ -89,10 +89,9 @@ type BlockChain struct {
scope event.SubscriptionScope
genesisBlock *types.Block
mu sync.RWMutex // global mutex for locking chain operations
chainmu sync.RWMutex // blockchain insertion lock
procmu sync.RWMutex // block processor lock
insertmu sync.Mutex // block and state insert lock
mu sync.RWMutex // global mutex for locking chain operations
chainmu sync.RWMutex // blockchain insertion lock
procmu sync.RWMutex // block processor lock
checkpoint int // checkpoint counts towards the new checkpoint
currentBlock *types.Block // Current head of the block chain
@ -814,16 +813,6 @@ func (bc *BlockChain) WriteBlockAndState(block *types.Block, receipts []*types.R
bc.wg.Add(1)
defer bc.wg.Done()
bc.insertmu.Lock()
defer bc.insertmu.Unlock()
if bc.config.IsQuorum && bc.config.Istanbul != nil {
if bc.GetBlockByHash(block.Hash()) != nil {
log.Warn("Block already inserted", "number", block.NumberU64(), "hash", block.Hash())
return CanonStatTy, nil
}
}
// Calculate the total difficulty of the block
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
if ptd == nil {