aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-29 18:57:51 +0800
committerobscuren <geffobscura@gmail.com>2014-09-29 18:57:51 +0800
commitab6ede51d7fedb9270cab08ee732a834be34dab2 (patch)
treed8252f27d51c456e637140a312cadfe2ced71528 /ethereum.go
parentea0357bf02b61db94bd0ad8806ba7337a55a4f79 (diff)
downloadgo-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar.gz
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar.bz2
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar.lz
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar.xz
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.tar.zst
go-tangerine-ab6ede51d7fedb9270cab08ee732a834be34dab2.zip
Working on new (blocking) event machine.
The new event machine will be used for loose coupling and handle the communications between the services: 1) Block pool finds blocks which "links" with our current canonical chain 2) Posts the blocks on to the event machine 3) State manager receives blocks & processes them 4) Broadcasts new post block event
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/ethereum.go b/ethereum.go
index d04b08960..5fb3f2909 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -22,6 +22,7 @@ import (
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
+ "github.com/ethereum/eth-go/eventer"
)
const (
@@ -58,7 +59,9 @@ type Ethereum struct {
blockChain *ethchain.BlockChain
// The block pool
blockPool *BlockPool
- // Peers (NYI)
+ // Eventer
+ eventer *eventer.EventMachine
+ // Peers
peers *list.List
// Nonce
Nonce uint64
@@ -123,6 +126,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
filters: make(map[int]*ethchain.Filter),
}
ethereum.reactor = ethreact.New()
+ ethereum.eventer = eventer.New()
ethereum.blockPool = NewBlockPool(ethereum)
ethereum.txPool = ethchain.NewTxPool(ethereum)
@@ -161,6 +165,9 @@ func (s *Ethereum) TxPool() *ethchain.TxPool {
func (s *Ethereum) BlockPool() *BlockPool {
return s.blockPool
}
+func (s *Ethereum) Eventer() *eventer.EventMachine {
+ return s.eventer
+}
func (self *Ethereum) Db() ethutil.Database {
return self.db
}
@@ -387,6 +394,8 @@ func (s *Ethereum) ReapDeadPeerHandler() {
func (s *Ethereum) Start(seed bool) {
s.reactor.Start()
s.blockPool.Start()
+ s.stateManager.Start()
+
// Bind to addr and port
ln, err := net.Listen("tcp", ":"+s.Port)
if err != nil {