aboutsummaryrefslogtreecommitdiffstats
path: root/chain/chain_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-19 02:44:17 +0800
committerobscuren <geffobscura@gmail.com>2014-11-19 02:44:17 +0800
commitf8d0cd9906a1ec4a4a1e95868a279312363f8b49 (patch)
tree04bb1876142343c69a3542d0dbebe7cbefd68105 /chain/chain_manager.go
parenta1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b (diff)
downloaddexon-f8d0cd9906a1ec4a4a1e95868a279312363f8b49.tar.gz
dexon-f8d0cd9906a1ec4a4a1e95868a279312363f8b49.tar.zst
dexon-f8d0cd9906a1ec4a4a1e95868a279312363f8b49.zip
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.
Diffstat (limited to 'chain/chain_manager.go')
-rw-r--r--chain/chain_manager.go6
1 files changed, 3 insertions, 3 deletions
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()