diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-09 20:16:37 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-09 20:16:37 +0800 |
commit | 2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a (patch) | |
tree | e3e7d013e2ccae939df7dd1d8aa7dcb3802fadd7 /xeth | |
parent | 07cb8092e7a41e80224dc63691146e8714f94ebf (diff) | |
parent | a23478c0be94e1e727a64d20341b8d6f98d7f0a0 (diff) | |
download | dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.gz dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.bz2 dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.lz dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.xz dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.tar.zst dexon-2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a.zip |
Merge pull request #1604 from obscuren/db-merge
core, eth, trie, xeth: merged state, chain, extra databases in one
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/state.go | 2 | ||||
-rw-r--r-- | xeth/xeth.go | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/xeth/state.go b/xeth/state.go index 16bfb523d..981fe63b7 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -45,7 +45,7 @@ func (self *State) SafeGet(addr string) *Object { func (self *State) safeGet(addr string) *state.StateObject { object := self.state.GetStateObject(common.HexToAddress(addr)) if object == nil { - object = state.NewStateObject(common.HexToAddress(addr), self.xeth.backend.StateDb()) + object = state.NewStateObject(common.HexToAddress(addr), self.xeth.backend.ChainDb()) } return object diff --git a/xeth/xeth.go b/xeth/xeth.go index f447a1ac3..5110aa62c 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -213,9 +213,9 @@ func (self *XEth) AtStateNum(num int64) *XEth { st = self.backend.Miner().PendingState().Copy() default: if block := self.getBlockByHeight(num); block != nil { - st = state.New(block.Root(), self.backend.StateDb()) + st = state.New(block.Root(), self.backend.ChainDb()) } else { - st = state.New(self.backend.ChainManager().GetBlockByNumber(0).Root(), self.backend.StateDb()) + st = state.New(self.backend.ChainManager().GetBlockByNumber(0).Root(), self.backend.ChainDb()) } } @@ -259,7 +259,7 @@ func (self *XEth) UpdateState() (wait chan *big.Int) { wait <- n n = nil } - statedb := state.New(ev.Block.Root(), self.backend.StateDb()) + statedb := state.New(ev.Block.Root(), self.backend.ChainDb()) self.state = NewState(self, statedb) } case n, ok = <-wait: @@ -311,7 +311,7 @@ func (self *XEth) EthBlockByHash(strHash string) *types.Block { func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blhash common.Hash, blnum *big.Int, txi uint64) { // Due to increasing return params and need to determine if this is from transaction pool or // some chain, this probably needs to be refactored for more expressiveness - data, _ := self.backend.ExtraDb().Get(common.FromHex(hash)) + data, _ := self.backend.ChainDb().Get(common.FromHex(hash)) if len(data) != 0 { dtx := new(types.Transaction) if err := rlp.DecodeBytes(data, dtx); err != nil { @@ -330,7 +330,7 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha Index uint64 } - v, dberr := self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0001)) + v, dberr := self.backend.ChainDb().Get(append(common.FromHex(hash), 0x0001)) // TODO check specifically for ErrNotFound if dberr != nil { return @@ -365,7 +365,7 @@ func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts { } func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt { - return core.GetReceipt(self.backend.ExtraDb(), txhash) + return core.GetReceipt(self.backend.ChainDb(), txhash) } func (self *XEth) GasLimit() *big.Int { @@ -408,13 +408,13 @@ func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error) { // store DApp value in extra database func (self *XEth) DbPut(key, val []byte) bool { - self.backend.ExtraDb().Put(append(dappStorePre, key...), val) + self.backend.DappDb().Put(append(dappStorePre, key...), val) return true } // retrieve DApp value from extra database func (self *XEth) DbGet(key []byte) ([]byte, error) { - val, err := self.backend.ExtraDb().Get(append(dappStorePre, key...)) + val, err := self.backend.DappDb().Get(append(dappStorePre, key...)) return val, err } |