fix shard state update bug (#439)

pull/443/head
chaosma 6 years ago committed by GitHub
parent 46ab9b1a1e
commit 5eb3684d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      core/blockchain.go
  2. 2
      node/node_handler.go

@ -1244,11 +1244,15 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty
cache, _ := bc.stateCache.TrieDB().Size()
stats.report(chain, i, cache)
// only insert new shardstate when block is epoch block
bc.InsertNewShardState(block)
}
// Append a single chain head event if we've progressed the chain
if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() {
events = append(events, ChainHeadEvent{lastCanon})
}
return 0, events, coalescedLogs, nil
}

@ -277,8 +277,6 @@ func (node *Node) AddNewBlock(newBlock *types.Block) {
} else {
utils.GetLogInstance().Info("adding new block to blockchain", "blockNum", blockNum)
}
// only insert new shardstate when newBlock is epoch block
node.blockchain.InsertNewShardState(newBlock)
}
func (node *Node) pingMessageHandler(msgPayload []byte) int {

Loading…
Cancel
Save