states moved to chain

This commit is contained in:
obscuren
2014-12-10 19:59:12 +01:00
parent af6afbaa56
commit 5553e5aaed
11 changed files with 31 additions and 28 deletions

View File

@ -103,7 +103,7 @@ func (self *Gui) DumpState(hash, path string) {
var stateDump []byte
if len(hash) == 0 {
stateDump = self.eth.BlockManager().CurrentState().Dump()
stateDump = self.eth.ChainManager().State().Dump()
} else {
var block *types.Block
if hash[0] == '#' {

View File

@ -141,8 +141,8 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
keyPair = self.lib.eth.KeyManager().KeyPair()
)
statedb := self.lib.eth.BlockManager().TransState()
account := self.lib.eth.BlockManager().TransState().GetAccount(keyPair.Address())
statedb := self.lib.eth.ChainManager().TransState()
account := self.lib.eth.ChainManager().TransState().GetAccount(keyPair.Address())
contract := statedb.NewStateObject([]byte{0})
contract.SetCode(script)
contract.SetBalance(value)

View File

@ -401,7 +401,7 @@ func (gui *Gui) update() {
generalUpdateTicker := time.NewTicker(500 * time.Millisecond)
statsUpdateTicker := time.NewTicker(5 * time.Second)
state := gui.eth.BlockManager().TransState()
state := gui.eth.ChainManager().TransState()
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance())))
@ -428,14 +428,14 @@ func (gui *Gui) update() {
case core.NewBlockEvent:
gui.processBlock(ev.Block, false)
if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 {
gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil)
gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
}
case core.TxPreEvent:
tx := ev.Tx
tstate := gui.eth.BlockManager().TransState()
cstate := gui.eth.BlockManager().CurrentState()
tstate := gui.eth.ChainManager().TransState()
cstate := gui.eth.ChainManager().State()
taccount := tstate.GetAccount(gui.address())
caccount := cstate.GetAccount(gui.address())

View File

@ -200,7 +200,7 @@ func (ui *UiLib) AssetPath(p string) string {
func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
dbWindow := NewDebuggerWindow(self)
object := self.eth.BlockManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash))
object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash))
if len(object.Code) > 0 {
dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Code))
}