aboutsummaryrefslogtreecommitdiffstats
path: root/chain/chain_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-03 21:05:19 +0800
committerobscuren <geffobscura@gmail.com>2014-12-03 21:05:19 +0800
commit82405501872385b240012070bad2f0eda643d423 (patch)
tree97fcdb3fb3be607d0b21e5da01bbd0f33372ffc2 /chain/chain_manager.go
parent709eff4ea77b965cdf763ada8ab248e3d850406f (diff)
downloadgo-tangerine-82405501872385b240012070bad2f0eda643d423.tar
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.gz
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.bz2
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.lz
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.xz
go-tangerine-82405501872385b240012070bad2f0eda643d423.tar.zst
go-tangerine-82405501872385b240012070bad2f0eda643d423.zip
updated to types
Diffstat (limited to 'chain/chain_manager.go')
-rw-r--r--chain/chain_manager.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/chain/chain_manager.go b/chain/chain_manager.go
index 8525ffdfd..9b35ce08a 100644
--- a/chain/chain_manager.go
+++ b/chain/chain_manager.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
)
@@ -45,6 +46,7 @@ func CalcDifficulty(block, parent *types.Block) *big.Int {
type ChainManager struct {
//eth EthManager
processor types.BlockProcessor
+ eventMux *event.TypeMux
genesisBlock *types.Block
// Last known total difficulty
TD *big.Int
@@ -55,10 +57,10 @@ type ChainManager struct {
LastBlockHash []byte
}
-func NewChainManager() *ChainManager {
+func NewChainManager(mux *event.TypeMux) *ChainManager {
bc := &ChainManager{}
bc.genesisBlock = types.NewBlockFromBytes(ethutil.Encode(Genesis))
- //bc.eth = ethereum
+ bc.eventMux = mux
bc.setLastBlock()
@@ -250,9 +252,9 @@ func (bc *ChainManager) Stop() {
}
}
-func (self *ChainManager) InsertChain(chain Blocks) error {
+func (self *ChainManager) InsertChain(chain types.Blocks) error {
for _, block := range chain {
- td, messages, err := self.Ethereum.BlockManager().Process(block)
+ td, messages, err := self.processor.Process(block)
if err != nil {
if IsKnownBlockErr(err) {
continue
@@ -266,8 +268,8 @@ func (self *ChainManager) InsertChain(chain Blocks) error {
self.add(block)
self.SetTotalDifficulty(td)
- self.Ethereum.EventMux().Post(NewBlockEvent{block})
- self.Ethereum.EventMux().Post(messages)
+ self.eventMux.Post(NewBlockEvent{block})
+ self.eventMux.Post(messages)
}
return nil