This commit is contained in:
obscuren
2015-03-19 16:59:13 +01:00
12 changed files with 273 additions and 176 deletions

View File

@ -410,7 +410,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
for i, block := range chain {
// Call in to the block processor and check for errors. It's likely that if one block fails
// all others will fail too (unless a known block is returned).
td, err := self.processor.Process(block)
td, logs, err := self.processor.Process(block)
if err != nil {
if IsKnownBlockErr(err) {
continue
@ -438,29 +438,27 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
hash := block.Hash()
chainlogger.Infof("Split detected. New head #%v (%x) TD=%v, was #%v (%x) TD=%v\n", block.Header().Number, hash[:4], td, cblock.Header().Number, chash[:4], self.td)
queue[i] = ChainSplitEvent{block}
queue[i] = ChainSplitEvent{block, logs}
queueEvent.splitCount++
}
self.setTotalDifficulty(td)
self.insert(block)
/* XXX crashes
jsonlogger.LogJson(&logger.EthChainNewHead{
BlockHash: common.Bytes2Hex(block.Hash()),
BlockHash: block.Hash().Hex(),
BlockNumber: block.Number(),
ChainHeadHash: common.Bytes2Hex(cblock.Hash()),
BlockPrevHash: common.Bytes2Hex(block.ParentHash()),
ChainHeadHash: cblock.Hash().Hex(),
BlockPrevHash: block.ParentHash().Hex(),
})
*/
self.setTransState(state.New(block.Root(), self.stateDb))
self.setTxState(state.New(block.Root(), self.stateDb))
queue[i] = ChainEvent{block}
queue[i] = ChainEvent{block, logs}
queueEvent.canonicalCount++
} else {
queue[i] = ChainSideEvent{block}
queue[i] = ChainSideEvent{block, logs}
queueEvent.sideCount++
}
}