From 6ea44c466a5c3383dd4e21a57423edbf33a52e6f Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 20 Oct 2014 12:03:31 +0200 Subject: [PATCH] Updated to reflect BlockChain changes --- ethereum/main.go | 6 +++--- javascript/javascript_runtime.go | 4 ++-- mist/bindings.go | 4 ++-- mist/debugger.go | 2 +- mist/gui.go | 12 ++++++------ utils/cmd.go | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ethereum/main.go b/ethereum/main.go index b8f8ce39ad..bff5485df1 100644 --- a/ethereum/main.go +++ b/ethereum/main.go @@ -60,11 +60,11 @@ func main() { var block *ethchain.Block if len(DumpHash) == 0 && DumpNumber == -1 { - block = ethereum.BlockChain().CurrentBlock + block = ethereum.ChainManager().CurrentBlock } else if len(DumpHash) > 0 { - block = ethereum.BlockChain().GetBlock(ethutil.Hex2Bytes(DumpHash)) + block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash)) } else { - block = ethereum.BlockChain().GetBlockByNumber(uint64(DumpNumber)) + block = ethereum.ChainManager().GetBlockByNumber(uint64(DumpNumber)) } if block == nil { diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go index 16e22964f9..189106ae90 100644 --- a/javascript/javascript_runtime.go +++ b/javascript/javascript_runtime.go @@ -139,10 +139,10 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value { var block *ethchain.Block if call.Argument(0).IsNumber() { num, _ := call.Argument(0).ToInteger() - block = self.ethereum.BlockChain().GetBlockByNumber(uint64(num)) + block = self.ethereum.ChainManager().GetBlockByNumber(uint64(num)) } else if call.Argument(0).IsString() { hash, _ := call.Argument(0).ToString() - block = self.ethereum.BlockChain().GetBlock(ethutil.Hex2Bytes(hash)) + block = self.ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(hash)) } else { fmt.Println("invalid argument for dump. Either hex string or number") } diff --git a/mist/bindings.go b/mist/bindings.go index aa8bba1e48..972e4e8ed3 100644 --- a/mist/bindings.go +++ b/mist/bindings.go @@ -96,9 +96,9 @@ func (self *Gui) DumpState(hash, path string) { var block *ethchain.Block if hash[0] == '#' { i, _ := strconv.Atoi(hash[1:]) - block = self.eth.BlockChain().GetBlockByNumber(uint64(i)) + block = self.eth.ChainManager().GetBlockByNumber(uint64(i)) } else { - block = self.eth.BlockChain().GetBlock(ethutil.Hex2Bytes(hash)) + block = self.eth.ChainManager().GetBlock(ethutil.Hex2Bytes(hash)) } if block == nil { diff --git a/mist/debugger.go b/mist/debugger.go index f364a487e8..f81cddb1bc 100644 --- a/mist/debugger.go +++ b/mist/debugger.go @@ -131,7 +131,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data self.SetAsm(script) - block := self.lib.eth.BlockChain().CurrentBlock + block := self.lib.eth.ChainManager().CurrentBlock callerClosure := vm.NewClosure(ðstate.Message{}, account, contract, script, gas, gasPrice) env := utils.NewEnv(state, block, account.Address(), value) diff --git a/mist/gui.go b/mist/gui.go index 84ee1ea00a..1bb8a1934d 100644 --- a/mist/gui.go +++ b/mist/gui.go @@ -228,10 +228,10 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { return gui.eth.KeyManager().KeyPair().AsStrings() } -func (gui *Gui) setInitialBlockChain() { - sBlk := gui.eth.BlockChain().LastBlockHash - blk := gui.eth.BlockChain().GetBlock(sBlk) - for ; blk != nil; blk = gui.eth.BlockChain().GetBlock(sBlk) { +func (gui *Gui) setInitialChainManager() { + sBlk := gui.eth.ChainManager().LastBlockHash + blk := gui.eth.ChainManager().GetBlock(sBlk) + for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash addr := gui.address() @@ -363,7 +363,7 @@ func (gui *Gui) update() { } go func() { - go gui.setInitialBlockChain() + go gui.setInitialChainManager() gui.loadAddressBook() gui.setPeerInfo() gui.readPreviousTransactions() @@ -464,7 +464,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() case <-generalUpdateTicker.C: - statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String() + statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() lastBlockLabel.Set("text", statusText) if gui.miner != nil { diff --git a/utils/cmd.go b/utils/cmd.go index 060e8067bf..09898665f4 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -169,7 +169,7 @@ func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) { } func ShowGenesis(ethereum *eth.Ethereum) { - logger.Infoln(ethereum.BlockChain().Genesis()) + logger.Infoln(ethereum.ChainManager().Genesis()) exit(nil) } @@ -310,12 +310,12 @@ func StopMining(ethereum *eth.Ethereum) bool { // Replay block func BlockDo(ethereum *eth.Ethereum, hash []byte) error { - block := ethereum.BlockChain().GetBlock(hash) + block := ethereum.ChainManager().GetBlock(hash) if block == nil { return fmt.Errorf("unknown block %x", hash) } - parent := ethereum.BlockChain().GetBlock(block.PrevHash) + parent := ethereum.ChainManager().GetBlock(block.PrevHash) _, err := ethereum.StateManager().ApplyDiff(parent.State(), parent, block) if err != nil {