forked from cerc-io/plugeth
Merge fixes
This commit is contained in:
parent
721e8ae93f
commit
0dc566124a
@ -101,7 +101,10 @@ func NewChainManager(mux *event.TypeMux) *ChainManager {
|
||||
}
|
||||
|
||||
func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) {
|
||||
return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash()
|
||||
self.mu.RLock()
|
||||
defer self.mu.RUnlock()
|
||||
|
||||
return self.td, self.currentBlock.Hash(), self.Genesis().Hash()
|
||||
}
|
||||
|
||||
func (self *ChainManager) SetProcessor(proc types.BlockProcessor) {
|
||||
|
@ -72,19 +72,17 @@ type TxPool struct {
|
||||
|
||||
subscribers []chan TxMsg
|
||||
|
||||
broadcaster types.Broadcaster
|
||||
chainManager *ChainManager
|
||||
eventMux *event.TypeMux
|
||||
}
|
||||
|
||||
func NewTxPool(chainManager *ChainManager, broadcaster types.Broadcaster, eventMux *event.TypeMux) *TxPool {
|
||||
func NewTxPool(chainManager *ChainManager, eventMux *event.TypeMux) *TxPool {
|
||||
return &TxPool{
|
||||
pool: list.New(),
|
||||
queueChan: make(chan *types.Transaction, txPoolQueueSize),
|
||||
quit: make(chan bool),
|
||||
chainManager: chainManager,
|
||||
eventMux: eventMux,
|
||||
broadcaster: broadcaster,
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +94,7 @@ func (pool *TxPool) addTransaction(tx *types.Transaction) {
|
||||
pool.pool.PushBack(tx)
|
||||
|
||||
// Broadcast the transaction to the rest of the peers
|
||||
pool.Ethereum.EventMux().Post(TxPreEvent{tx})
|
||||
pool.eventMux.Post(TxPreEvent{tx})
|
||||
}
|
||||
|
||||
func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
|
||||
|
@ -4,13 +4,8 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/state"
|
||||
"github.com/ethereum/go-ethereum/wire"
|
||||
)
|
||||
|
||||
type BlockProcessor interface {
|
||||
Process(*Block) (*big.Int, state.Messages, error)
|
||||
}
|
||||
|
||||
type Broadcaster interface {
|
||||
Broadcast(wire.MsgType, []interface{})
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke
|
||||
eventMux: &event.TypeMux{},
|
||||
}
|
||||
|
||||
eth.txPool = core.NewTxPool(eth)
|
||||
eth.chainManager = core.NewChainManager(eth.EventMux())
|
||||
eth.blockManager = core.NewBlockManager(eth)
|
||||
eth.txPool = core.NewTxPool(eth.chainManager, eth.EventMux())
|
||||
eth.blockManager = core.NewBlockManager(eth.txPool, eth.chainManager, eth.EventMux())
|
||||
eth.chainManager.SetProcessor(eth.blockManager)
|
||||
eth.whisper = whisper.New()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user