aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/block_manager.go10
-rw-r--r--core/chain_manager.go13
-rw-r--r--core/transaction_pool.go2
3 files changed, 14 insertions, 11 deletions
diff --git a/core/block_manager.go b/core/block_manager.go
index 80b2542b5..7227c6f95 100644
--- a/core/block_manager.go
+++ b/core/block_manager.go
@@ -84,20 +84,10 @@ func NewBlockManager(ethereum EthManager) *BlockManager {
eth: ethereum,
bc: ethereum.ChainManager(),
}
- sm.transState = ethereum.ChainManager().CurrentBlock.State().Copy()
- sm.miningState = ethereum.ChainManager().CurrentBlock.State().Copy()
return sm
}
-func (sm *BlockManager) CurrentState() *state.StateDB {
- return sm.eth.ChainManager().CurrentBlock.State()
-}
-
-func (sm *BlockManager) TransState() *state.StateDB {
- return sm.transState
-}
-
func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error) {
coinbase := statedb.GetOrNewStateObject(block.Coinbase)
coinbase.SetGasPool(block.CalcGasLimit(parent))
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 150139def..0322edaa5 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/state"
)
var chainlogger = logger.NewLogger("CHAIN")
@@ -55,6 +56,8 @@ type ChainManager struct {
CurrentBlock *types.Block
LastBlockHash []byte
+
+ transState *state.StateDB
}
func NewChainManager(mux *event.TypeMux) *ChainManager {
@@ -64,6 +67,8 @@ func NewChainManager(mux *event.TypeMux) *ChainManager {
bc.setLastBlock()
+ bc.transState = bc.State().Copy()
+
return bc
}
@@ -71,6 +76,14 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) {
self.processor = proc
}
+func (self *ChainManager) State() *state.StateDB {
+ return self.CurrentBlock.State()
+}
+
+func (self *ChainManager) TransState() *state.StateDB {
+ return self.transState
+}
+
func (bc *ChainManager) setLastBlock() {
data, _ := ethutil.Config.Db.Get([]byte("LastBlock"))
if len(data) != 0 {
diff --git a/core/transaction_pool.go b/core/transaction_pool.go
index 1d1f478e4..7166d35e8 100644
--- a/core/transaction_pool.go
+++ b/core/transaction_pool.go
@@ -116,7 +116,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
}
// Get the sender
- sender := pool.Ethereum.BlockManager().CurrentState().GetAccount(tx.Sender())
+ sender := pool.Ethereum.ChainManager().State().GetAccount(tx.Sender())
totAmount := new(big.Int).Set(tx.Value)
// Make sure there's enough in the sender's account. Having insufficient