From f8d0cd9906a1ec4a4a1e95868a279312363f8b49 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 18 Nov 2014 19:44:17 +0100 Subject: Added a callback mechanism to chain adding. Not sure if this is the right approach. Why? BlockChain shouldn't need the "Ethereum" object. BlockChain shouldn't need to worry about notifying listeners or message propagation. --- chain/chain_manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'chain') diff --git a/chain/chain_manager.go b/chain/chain_manager.go index 11df4e17e..970fa5377 100644 --- a/chain/chain_manager.go +++ b/chain/chain_manager.go @@ -271,14 +271,14 @@ func (self *ChainManager) NewIterator(startHash []byte) *ChainIterator { } // This function assumes you've done your checking. No checking is done at this stage anymore -func (self *ChainManager) InsertChain(chain *BlockChain) { +func (self *ChainManager) InsertChain(chain *BlockChain, call func(*types.Block, state.Messages)) { for e := chain.Front(); e != nil; e = e.Next() { link := e.Value.(*link) self.add(link.block) self.SetTotalDifficulty(link.td) - //self.eth.EventMux().Post(NewBlockEvent{link.block}) - //self.eth.EventMux().Post(link.messages) + + call(link.block, link.messages) } b, e := chain.Front(), chain.Back() -- cgit v1.2.3