diff options
author | obscuren <geffobscura@gmail.com> | 2014-11-10 20:27:24 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-11-10 20:27:24 +0800 |
commit | ad0acb5762669aac8d39bd65c0c5df23efbb2d9e (patch) | |
tree | 95a2d7bd3b2bd132b6f0672ab920f3527e5527f3 /chain/chain_manager.go | |
parent | ebb7db263ff219eaaacaa2d74d42f69fcd396645 (diff) | |
download | dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar.gz dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar.bz2 dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar.lz dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar.xz dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.tar.zst dexon-ad0acb5762669aac8d39bd65c0c5df23efbb2d9e.zip |
Moved messages eventing to chain manager
Diffstat (limited to 'chain/chain_manager.go')
-rw-r--r-- | chain/chain_manager.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/chain/chain_manager.go b/chain/chain_manager.go index 18961400c..46e0703c1 100644 --- a/chain/chain_manager.go +++ b/chain/chain_manager.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/state" ) var chainlogger = logger.NewLogger("CHAIN") @@ -303,8 +304,9 @@ func (bc *ChainManager) Stop() { } type link struct { - block *Block - td *big.Int + block *Block + messages state.Messages + td *big.Int } type BlockChain struct { @@ -315,7 +317,7 @@ func NewChain(blocks Blocks) *BlockChain { chain := &BlockChain{list.New()} for _, block := range blocks { - chain.PushBack(&link{block, nil}) + chain.PushBack(&link{block, nil, nil}) } return chain @@ -329,6 +331,7 @@ func (self *ChainManager) InsertChain(chain *BlockChain) { self.SetTotalDifficulty(link.td) self.add(link.block) self.Ethereum.EventMux().Post(NewBlockEvent{link.block}) + self.Ethereum.EventMux().Post(link.messages) } } @@ -350,7 +353,8 @@ func (self *ChainManager) TestChain(chain *BlockChain) (td *big.Int, err error) return } - td, err = self.Ethereum.BlockManager().ProcessWithParent(block, parent) + var messages state.Messages + td, messages, err = self.Ethereum.BlockManager().ProcessWithParent(block, parent) if err != nil { chainlogger.Infoln(err) chainlogger.Debugf("Block #%v failed (%x...)\n", block.Number, block.Hash()[0:4]) @@ -360,6 +364,7 @@ func (self *ChainManager) TestChain(chain *BlockChain) (td *big.Int, err error) return } l.td = td + l.messages = messages } if td.Cmp(self.TD) <= 0 { |