From a23478c0be94e1e727a64d20341b8d6f98d7f0a0 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 19:57:39 +0200 Subject: core, eth, trie, xeth: merged state, chain, extra databases in one --- xeth/state.go | 2 +- xeth/xeth.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'xeth') 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 372068c14..b80b62155 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 } -- cgit v1.2.3