aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-11 03:26:55 +0800
committerobscuren <geffobscura@gmail.com>2014-12-11 03:26:55 +0800
commit2b5fcb464262a7bdd766861b513b2a23706f8b13 (patch)
tree63f23ea941e664d3b4342c6394794c378dc2adab /core
parent5553e5aaed5c3f4e303b7d6671d2c92a45aa487e (diff)
downloaddexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar.gz
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar.bz2
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar.lz
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar.xz
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.tar.zst
dexon-2b5fcb464262a7bdd766861b513b2a23706f8b13.zip
moved interfaces
Diffstat (limited to 'core')
-rw-r--r--core/block_manager.go23
-rw-r--r--core/chain_manager.go2
2 files changed, 10 insertions, 15 deletions
diff --git a/core/block_manager.go b/core/block_manager.go
index 7227c6f95..f6c73bc2c 100644
--- a/core/block_manager.go
+++ b/core/block_manager.go
@@ -60,14 +60,6 @@ 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
@@ -75,14 +67,17 @@ type BlockManager struct {
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
@@ -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)
@@ -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
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 0322edaa5..edf50e715 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -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})