diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-15 19:34:06 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-15 19:34:06 +0800 |
commit | 96272e19a6b7a3163ec53f45e04407e9d2ff8414 (patch) | |
tree | 5ee02c968d824bc33790d992b63d107be3bbb6ac | |
parent | bd9088792b0a7bcac00f28289a08bd1b8359316f (diff) | |
download | dexon-96272e19a6b7a3163ec53f45e04407e9d2ff8414.tar.gz dexon-96272e19a6b7a3163ec53f45e04407e9d2ff8414.tar.zst dexon-96272e19a6b7a3163ec53f45e04407e9d2ff8414.zip |
removed filter manager from base
-rw-r--r-- | cmd/mist/ui_lib.go | 11 | ||||
-rw-r--r-- | eth/backend.go | 15 | ||||
-rw-r--r-- | eth/protocol.go | 43 |
3 files changed, 32 insertions, 37 deletions
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index fdbde50fd..d5578645f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -24,7 +24,6 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -64,6 +63,7 @@ type UiLib struct { func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} lib.miner = miner.New(eth.KeyManager().Address(), eth) + //eth.filterManager = filter.NewFilterManager(eth.EventMux()) return lib } @@ -372,3 +372,12 @@ func (self *UiLib) ToggleMining() bool { return false } } + +/* +// XXX Refactor me & MOVE +func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { + return self.filterManager.InstallFilter(filter) +} +func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } +func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } +*/ diff --git a/eth/backend.go b/eth/backend.go index fb401a68d..3ec36d3fc 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/event/filter" ethlogger "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/pow/ezp" @@ -53,11 +52,6 @@ type Ethereum struct { synclock sync.Mutex syncGroup sync.WaitGroup - filterManager *filter.FilterManager - //filterMu sync.RWMutex - //filterId int - //filters map[int]*core.Filter - Mining bool } @@ -81,7 +75,6 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke eth.blockManager = core.NewBlockManager(eth) eth.chainManager.SetProcessor(eth.blockManager) eth.whisper = whisper.New() - eth.filterManager = filter.NewFilterManager(eth.EventMux()) hasBlock := eth.chainManager.HasBlock insertChain := eth.chainManager.InsertChain @@ -163,7 +156,6 @@ func (s *Ethereum) Start(seed bool) error { } s.blockPool.Start() s.whisper.Start() - s.filterManager.Start() // broadcast transactions s.txSub = s.eventMux.Subscribe(core.TxPreEvent{}) @@ -264,10 +256,3 @@ func saveProtocolVersion(db ethutil.Database) { db.Put([]byte("ProtocolVersion"), ethutil.NewValue(ProtocolVersion).Bytes()) } } - -// XXX Refactor me & MOVE -func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) { - return self.filterManager.InstallFilter(filter) -} -func (self *Ethereum) UninstallFilter(id int) { self.filterManager.UninstallFilter(id) } -func (self *Ethereum) GetFilter(id int) *core.Filter { return self.filterManager.GetFilter(id) } diff --git a/eth/protocol.go b/eth/protocol.go index 3b5b49696..8cbf6d309 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -11,6 +11,25 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) +const ( + ProtocolVersion = 49 + NetworkId = 0 + ProtocolLength = uint64(8) + ProtocolMaxMsgSize = 10 * 1024 * 1024 +) + +// eth protocol message codes +const ( + StatusMsg = iota + GetTxMsg // unused + TxMsg + GetBlockHashesMsg + BlockHashesMsg + GetBlocksMsg + BlocksMsg + NewBlockMsg +) + // ethProtocol represents the ethereum wire protocol // instance is running on each peer type ethProtocol struct { @@ -41,25 +60,6 @@ type blockPool interface { RemovePeer(peerId string) } -const ( - ProtocolVersion = 43 - NetworkId = 0 - ProtocolLength = uint64(8) - ProtocolMaxMsgSize = 10 * 1024 * 1024 -) - -// eth protocol message codes -const ( - StatusMsg = iota - GetTxMsg // unused - TxMsg - GetBlockHashesMsg - BlockHashesMsg - GetBlocksMsg - BlocksMsg - NewBlockMsg -) - // message structs used for rlp decoding type newBlockMsgData struct { Block *types.Block @@ -279,9 +279,10 @@ func (self *ethProtocol) handleStatus() error { return ProtocolError(ErrProtocolVersionMismatch, "%d (!= %d)", status.ProtocolVersion, ProtocolVersion) } - self.peer.Infof("Peer is [eth] capable (%d/%d). TD = %v ~ %x", status.ProtocolVersion, status.NetworkId, status.CurrentBlock) + self.peer.Infof("Peer is [eth] capable (%d/%d). TD=%v H=%x\n", status.ProtocolVersion, status.NetworkId, status.TD, status.CurrentBlock[:4]) - self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) + //self.blockPool.AddPeer(status.TD, status.CurrentBlock, self.id, self.requestBlockHashes, self.requestBlocks, self.protoErrorDisconnect) + self.peer.Infoln("AddPeer(IGNORED)") return nil } |