forked from cerc-io/plugeth
moved interfaces
This commit is contained in:
parent
5553e5aaed
commit
2b5fcb4642
@ -60,14 +60,6 @@ type BlockManager struct {
|
|||||||
Pow pow.PoW
|
Pow pow.PoW
|
||||||
// The ethereum manager interface
|
// The ethereum manager interface
|
||||||
eth EthManager
|
eth EthManager
|
||||||
// The managed states
|
|
||||||
// Transiently state. The trans state isn't ever saved, validated and
|
|
||||||
// it could be used for setting account nonces without effecting
|
|
||||||
// the main states.
|
|
||||||
transState *state.StateDB
|
|
||||||
// Mining state. The mining state is used purely and solely by the mining
|
|
||||||
// operation.
|
|
||||||
miningState *state.StateDB
|
|
||||||
|
|
||||||
// The last attempted block is mainly used for debugging purposes
|
// The last attempted block is mainly used for debugging purposes
|
||||||
// This does not have to be a valid block and will be set during
|
// This does not have to be a valid block and will be set during
|
||||||
@ -75,14 +67,17 @@ type BlockManager struct {
|
|||||||
lastAttemptedBlock *types.Block
|
lastAttemptedBlock *types.Block
|
||||||
|
|
||||||
events event.Subscription
|
events event.Subscription
|
||||||
|
|
||||||
|
eventMux *event.TypeMux
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBlockManager(ethereum EthManager) *BlockManager {
|
func NewBlockManager(ethereum EthManager) *BlockManager {
|
||||||
sm := &BlockManager{
|
sm := &BlockManager{
|
||||||
mem: make(map[string]*big.Int),
|
mem: make(map[string]*big.Int),
|
||||||
Pow: ezp.New(),
|
Pow: ezp.New(),
|
||||||
eth: ethereum,
|
eth: ethereum,
|
||||||
bc: ethereum.ChainManager(),
|
bc: ethereum.ChainManager(),
|
||||||
|
eventMux: ethereum.EventMux(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return sm
|
return sm
|
||||||
@ -151,7 +146,7 @@ done:
|
|||||||
|
|
||||||
// Notify all subscribers
|
// Notify all subscribers
|
||||||
if !transientProcess {
|
if !transientProcess {
|
||||||
go self.eth.EventMux().Post(TxPostEvent{tx})
|
go self.eventMux.Post(TxPostEvent{tx})
|
||||||
}
|
}
|
||||||
|
|
||||||
receipts = append(receipts, receipt)
|
receipts = append(receipts, receipt)
|
||||||
@ -245,8 +240,6 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I
|
|||||||
|
|
||||||
chainlogger.Infof("Processed block #%d (%x...)\n", block.Number, block.Hash()[0:4])
|
chainlogger.Infof("Processed block #%d (%x...)\n", block.Number, block.Hash()[0:4])
|
||||||
|
|
||||||
sm.transState = state.Copy()
|
|
||||||
|
|
||||||
sm.eth.TxPool().RemoveSet(block.Transactions())
|
sm.eth.TxPool().RemoveSet(block.Transactions())
|
||||||
|
|
||||||
return td, messages, nil
|
return td, messages, nil
|
||||||
|
@ -288,6 +288,8 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
|
|||||||
|
|
||||||
self.SetTotalDifficulty(td)
|
self.SetTotalDifficulty(td)
|
||||||
self.insert(block)
|
self.insert(block)
|
||||||
|
self.transState = self.State().Copy()
|
||||||
|
//sm.eth.TxPool().RemoveSet(block.Transactions())
|
||||||
}
|
}
|
||||||
|
|
||||||
self.eventMux.Post(NewBlockEvent{block})
|
self.eventMux.Post(NewBlockEvent{block})
|
||||||
|
Loading…
Reference in New Issue
Block a user