Skip to content

Commit

Permalink
moved interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Dec 10, 2014
1 parent 5553e5a commit 2b5fcb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 8 additions & 15 deletions core/block_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,24 @@ type BlockManager struct {
Pow pow.PoW
// The ethereum manager interface
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
// This does not have to be a valid block and will be set during
// 'Process' & canonical validation.
lastAttemptedBlock *types.Block

events event.Subscription

eventMux *event.TypeMux
}

func NewBlockManager(ethereum EthManager) *BlockManager {
sm := &BlockManager{
mem: make(map[string]*big.Int),
Pow: ezp.New(),
eth: ethereum,
bc: ethereum.ChainManager(),
mem: make(map[string]*big.Int),
Pow: ezp.New(),
eth: ethereum,
bc: ethereum.ChainManager(),
eventMux: ethereum.EventMux(),
}

return sm
Expand Down Expand Up @@ -151,7 +146,7 @@ done:

// Notify all subscribers
if !transientProcess {
go self.eth.EventMux().Post(TxPostEvent{tx})
go self.eventMux.Post(TxPostEvent{tx})
}

receipts = append(receipts, receipt)
Expand Down Expand Up @@ -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])

sm.transState = state.Copy()

sm.eth.TxPool().RemoveSet(block.Transactions())

return td, messages, nil
Expand Down
2 changes: 2 additions & 0 deletions core/chain_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {

self.SetTotalDifficulty(td)
self.insert(block)
self.transState = self.State().Copy()
//sm.eth.TxPool().RemoveSet(block.Transactions())
}

self.eventMux.Post(NewBlockEvent{block})
Expand Down

0 comments on commit 2b5fcb4

Please sign in to comment.