diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-04 18:40:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-04 18:40:20 +0800 |
commit | f298ffdbb8ec2b14f254e880a65f22f4d7c66305 (patch) | |
tree | 59b0edc06529785afef7c103e9bdbd4248ec58da /core | |
parent | 3664cd58e3631fccf4d9aba1932e0bb63ad442a6 (diff) | |
download | dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar.gz dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar.bz2 dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar.lz dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar.xz dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.tar.zst dexon-f298ffdbb8ec2b14f254e880a65f22f4d7c66305.zip |
Renamed State => StateDB
Diffstat (limited to 'core')
-rw-r--r-- | core/block_manager.go | 18 | ||||
-rw-r--r-- | core/state_transition.go | 6 | ||||
-rw-r--r-- | core/transaction_pool.go | 2 | ||||
-rw-r--r-- | core/types/block.go | 4 | ||||
-rw-r--r-- | core/types/transaction.go | 2 | ||||
-rw-r--r-- | core/vm_env.go | 6 |
6 files changed, 19 insertions, 19 deletions
diff --git a/core/block_manager.go b/core/block_manager.go index f0b78b675..aa981430d 100644 --- a/core/block_manager.go +++ b/core/block_manager.go @@ -62,10 +62,10 @@ type BlockManager struct { // 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.State + transState *state.StateDB // Mining state. The mining state is used purely and solely by the mining // operation. - miningState *state.State + 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 @@ -96,19 +96,19 @@ func (self *BlockManager) Stop() { statelogger.Debugln("Stopping state manager") } -func (sm *BlockManager) CurrentState() *state.State { +func (sm *BlockManager) CurrentState() *state.StateDB { return sm.eth.ChainManager().CurrentBlock.State() } -func (sm *BlockManager) TransState() *state.State { +func (sm *BlockManager) TransState() *state.StateDB { return sm.transState } -func (sm *BlockManager) MiningState() *state.State { +func (sm *BlockManager) MiningState() *state.StateDB { return sm.miningState } -func (sm *BlockManager) NewMiningState() *state.State { +func (sm *BlockManager) NewMiningState() *state.StateDB { sm.miningState = sm.eth.ChainManager().CurrentBlock.State().Copy() return sm.miningState @@ -118,7 +118,7 @@ func (sm *BlockManager) ChainManager() *ChainManager { return sm.bc } -func (sm *BlockManager) TransitionState(statedb *state.State, parent, block *types.Block) (receipts types.Receipts, err error) { +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)) @@ -131,7 +131,7 @@ func (sm *BlockManager) TransitionState(statedb *state.State, parent, block *typ return receipts, nil } -func (self *BlockManager) ProcessTransactions(coinbase *state.StateObject, state *state.State, block, parent *types.Block, txs types.Transactions) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) { +func (self *BlockManager) ProcessTransactions(coinbase *state.StateObject, state *state.StateDB, block, parent *types.Block, txs types.Transactions) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error) { var ( receipts types.Receipts handled, unhandled types.Transactions @@ -342,7 +342,7 @@ func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error { return nil } -func (sm *BlockManager) AccumelateRewards(statedb *state.State, block, parent *types.Block) error { +func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent *types.Block) error { reward := new(big.Int).Set(BlockReward) knownUncles := ethutil.Set(parent.Uncles) diff --git a/core/state_transition.go b/core/state_transition.go index e3eea57de..3c45ddbf9 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -31,13 +31,13 @@ type StateTransition struct { gas, gasPrice *big.Int value *big.Int data []byte - state *state.State + state *state.StateDB block *types.Block cb, rec, sen *state.StateObject } -func NewStateTransition(coinbase *state.StateObject, tx *types.Transaction, state *state.State, block *types.Block) *StateTransition { +func NewStateTransition(coinbase *state.StateObject, tx *types.Transaction, state *state.StateDB, block *types.Block) *StateTransition { return &StateTransition{coinbase.Address(), tx.Recipient, tx, new(big.Int), new(big.Int).Set(tx.GasPrice), tx.Value, tx.Data, state, block, coinbase, nil, nil} } @@ -188,7 +188,7 @@ func (self *StateTransition) TransitionState() (err error) { } // Converts an transaction in to a state object -func MakeContract(tx *types.Transaction, state *state.State) *state.StateObject { +func MakeContract(tx *types.Transaction, state *state.StateDB) *state.StateObject { addr := tx.CreationAddress(state) contract := state.GetOrNewStateObject(addr) diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 2a14e48b2..abacb14f1 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -186,7 +186,7 @@ func (pool *TxPool) CurrentTransactions() []*types.Transaction { return txList } -func (pool *TxPool) RemoveInvalid(state *state.State) { +func (pool *TxPool) RemoveInvalid(state *state.StateDB) { pool.mutex.Lock() defer pool.mutex.Unlock() diff --git a/core/types/block.go b/core/types/block.go index feab7072f..55ce1fb9b 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -77,7 +77,7 @@ type Block struct { Coinbase []byte // Block Trie state //state *ethutil.Trie - state *state.State + state *state.StateDB // Difficulty for the current block Difficulty *big.Int // Creation time @@ -151,7 +151,7 @@ func (block *Block) HashNoNonce() []byte { return crypto.Sha3(ethutil.Encode(block.miningHeader())) } -func (block *Block) State() *state.State { +func (block *Block) State() *state.StateDB { return block.state } diff --git a/core/types/transaction.go b/core/types/transaction.go index efc90b6f2..63edef756 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -77,7 +77,7 @@ func (tx *Transaction) IsContract() bool { return tx.CreatesContract() } -func (tx *Transaction) CreationAddress(state *state.State) []byte { +func (tx *Transaction) CreationAddress(state *state.StateDB) []byte { // Generate a new address return crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:] } diff --git a/core/vm_env.go b/core/vm_env.go index 17686b28f..6332abc39 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -9,13 +9,13 @@ import ( ) type VMEnv struct { - state *state.State + state *state.StateDB block *types.Block tx *types.Transaction depth int } -func NewEnv(state *state.State, tx *types.Transaction, block *types.Block) *VMEnv { +func NewEnv(state *state.StateDB, tx *types.Transaction, block *types.Block) *VMEnv { return &VMEnv{ state: state, block: block, @@ -31,7 +31,7 @@ func (self *VMEnv) Time() int64 { return self.block.Time } func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty } func (self *VMEnv) BlockHash() []byte { return self.block.Hash() } func (self *VMEnv) Value() *big.Int { return self.tx.Value } -func (self *VMEnv) State() *state.State { return self.state } +func (self *VMEnv) State() *state.StateDB { return self.state } func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } func (self *VMEnv) Depth() int { return self.depth } func (self *VMEnv) SetDepth(i int) { self.depth = i } |