diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/disasm/main.go | 4 | ||||
-rw-r--r-- | cmd/ethereum/blocktest.go | 4 | ||||
-rw-r--r-- | cmd/ethereum/main.go | 6 | ||||
-rw-r--r-- | cmd/ethtest/main.go | 32 | ||||
-rw-r--r-- | cmd/evm/main.go | 12 | ||||
-rw-r--r-- | cmd/mist/bindings.go | 21 | ||||
-rw-r--r-- | cmd/mist/gui.go | 20 | ||||
-rw-r--r-- | cmd/mist/html_container.go | 8 | ||||
-rw-r--r-- | cmd/mist/main.go | 4 | ||||
-rw-r--r-- | cmd/mist/qml_container.go | 4 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 31 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 10 | ||||
-rw-r--r-- | cmd/utils/flags.go | 8 |
13 files changed, 73 insertions, 91 deletions
diff --git a/cmd/disasm/main.go b/cmd/disasm/main.go index c07246b00..5d42121b6 100644 --- a/cmd/disasm/main.go +++ b/cmd/disasm/main.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "os" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/vm" ) @@ -15,7 +15,7 @@ func main() { fmt.Println(err) os.Exit(1) } - code = ethutil.Hex2Bytes(string(code[:len(code)-1])) + code = common.Hex2Bytes(string(code[:len(code)-1])) fmt.Printf("%x\n", code) for pc := uint64(0); pc < uint64(len(code)); pc++ { diff --git a/cmd/ethereum/blocktest.go b/cmd/ethereum/blocktest.go index 1bb3809cf..e6d701d2c 100644 --- a/cmd/ethereum/blocktest.go +++ b/cmd/ethereum/blocktest.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/tests" ) @@ -41,7 +41,7 @@ func runblocktest(ctx *cli.Context) { } cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) - cfg.NewDB = func(path string) (ethutil.Database, error) { return ethdb.NewMemDatabase() } + cfg.NewDB = func(path string) (common.Database, error) { return ethdb.NewMemDatabase() } ethereum, err := eth.New(cfg) if err != nil { utils.Fatalf("%v", err) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 0dae5b79b..96b90b6e6 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -33,7 +33,7 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/peterh/liner" @@ -218,7 +218,7 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { } am := eth.AccountManager() // Attempt to unlock the account - err := am.Unlock(ethutil.FromHex(split[0]), split[1]) + err := am.Unlock(common.FromHex(split[0]), split[1]) if err != nil { utils.Fatalf("Unlock account failed '%v'", err) } @@ -302,7 +302,7 @@ func dump(ctx *cli.Context) { for _, arg := range ctx.Args() { var block *types.Block if hashish(arg) { - block = chainmgr.GetBlock(ethutil.Hex2Bytes(arg)) + block = chainmgr.GetBlock(common.Hex2Bytes(arg)) } else { num, _ := strconv.Atoi(arg) block = chainmgr.GetBlockByNumber(uint64(num)) diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index bbcde4c56..23ae9e525 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -34,7 +34,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" @@ -48,13 +48,13 @@ type Log struct { BloomF string `json:"bloom"` } -func (self Log) Address() []byte { return ethutil.Hex2Bytes(self.AddressF) } -func (self Log) Data() []byte { return ethutil.Hex2Bytes(self.DataF) } +func (self Log) Address() []byte { return common.Hex2Bytes(self.AddressF) } +func (self Log) Data() []byte { return common.Hex2Bytes(self.DataF) } func (self Log) RlpData() interface{} { return nil } func (self Log) Topics() [][]byte { t := make([][]byte, len(self.TopicsF)) for i, topic := range self.TopicsF { - t[i] = ethutil.Hex2Bytes(topic) + t[i] = common.Hex2Bytes(topic) } return t } @@ -66,15 +66,15 @@ type Account struct { Storage map[string]string } -func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject { - obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db) - obj.SetBalance(ethutil.Big(account.Balance)) +func StateObjectFromAccount(db common.Database, addr string, account Account) *state.StateObject { + obj := state.NewStateObject(common.Hex2Bytes(addr), db) + obj.SetBalance(common.Big(account.Balance)) - if ethutil.IsHex(account.Code) { + if common.IsHex(account.Code) { account.Code = account.Code[2:] } - obj.SetCode(ethutil.Hex2Bytes(account.Code)) - obj.SetNonce(ethutil.Big(account.Nonce).Uint64()) + obj.SetCode(common.Hex2Bytes(account.Code)) + obj.SetNonce(common.Big(account.Nonce).Uint64()) return obj } @@ -147,8 +147,8 @@ func RunVmTest(r io.Reader) (failed int) { } if len(test.Exec) == 0 { - if obj.Balance().Cmp(ethutil.Big(account.Balance)) != 0 { - fmt.Printf("FAIL: %s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(ethutil.Big(account.Balance), obj.Balance())) + if obj.Balance().Cmp(common.Big(account.Balance)) != 0 { + fmt.Printf("FAIL: %s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(common.Big(account.Balance), obj.Balance())) failed = 1 } } @@ -158,13 +158,13 @@ func RunVmTest(r io.Reader) (failed int) { vexp := helper.FromHex(value) if bytes.Compare(v, vexp) != 0 { - fmt.Printf("FAIL: %s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v)) + fmt.Printf("FAIL: %s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, common.BigD(vexp), common.BigD(v)) failed = 1 } } } - if !bytes.Equal(ethutil.Hex2Bytes(test.PostStateRoot), statedb.Root()) { + if !bytes.Equal(common.Hex2Bytes(test.PostStateRoot), statedb.Root()) { fmt.Printf("FAIL: %s's : Post state root error. Expected %s, got %x\n", name, test.PostStateRoot, statedb.Root()) failed = 1 } @@ -178,8 +178,8 @@ func RunVmTest(r io.Reader) (failed int) { fmt.Println("A", test.Logs) fmt.Println("B", logs) for i, log := range test.Logs { - genBloom := ethutil.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 256) - if !bytes.Equal(genBloom, ethutil.Hex2Bytes(log.BloomF)) { + genBloom := common.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 256) + if !bytes.Equal(genBloom, common.Hex2Bytes(log.BloomF)) { t.Errorf("bloom mismatch") } } diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 960558bb4..af15dd4d4 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -33,7 +33,7 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" @@ -63,13 +63,13 @@ func main() { statedb := state.New(nil, db) sender := statedb.NewStateObject([]byte("sender")) receiver := statedb.NewStateObject([]byte("receiver")) - receiver.SetCode(ethutil.Hex2Bytes(*code)) + receiver.SetCode(common.Hex2Bytes(*code)) - vmenv := NewEnv(statedb, []byte("evmuser"), ethutil.Big(*value)) + vmenv := NewEnv(statedb, []byte("evmuser"), common.Big(*value)) tstart := time.Now() - ret, e := vmenv.Call(sender, receiver.Address(), ethutil.Hex2Bytes(*data), ethutil.Big(*gas), ethutil.Big(*price), ethutil.Big(*value)) + ret, e := vmenv.Call(sender, receiver.Address(), common.Hex2Bytes(*data), common.Big(*gas), common.Big(*price), common.Big(*value)) logger.Flush() if e != nil { @@ -117,11 +117,11 @@ func NewEnv(state *state.StateDB, transactor []byte, value *big.Int) *VMEnv { func (self *VMEnv) State() *state.StateDB { return self.state } func (self *VMEnv) Origin() []byte { return self.transactor } -func (self *VMEnv) BlockNumber() *big.Int { return ethutil.Big0 } +func (self *VMEnv) BlockNumber() *big.Int { return common.Big0 } func (self *VMEnv) PrevHash() []byte { return make([]byte, 32) } func (self *VMEnv) Coinbase() []byte { return self.transactor } func (self *VMEnv) Time() int64 { return self.time } -func (self *VMEnv) Difficulty() *big.Int { return ethutil.Big1 } +func (self *VMEnv) Difficulty() *big.Int { return common.Big1 } func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) } func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) } diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index b56c0dddf..5d08e7dd7 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -26,8 +26,8 @@ import ( "strconv" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" ) @@ -37,32 +37,23 @@ type plugin struct { } func (gui *Gui) Transact(from, recipient, value, gas, gasPrice, d string) (string, error) { - var data string - if len(recipient) == 0 { - code, err := ethutil.Compile(d, false) - if err != nil { - return "", err - } - data = ethutil.Bytes2Hex(code) - } else { - data = ethutil.Bytes2Hex(utils.FormatTransactionData(d)) - } + d = common.Bytes2Hex(utils.FormatTransactionData(d)) - return gui.xeth.Transact(from, recipient, value, gas, gasPrice, data) + return gui.xeth.Transact(from, recipient, value, gas, gasPrice, d) } func (self *Gui) AddPlugin(pluginPath string) { self.plugins[pluginPath] = plugin{Name: pluginPath, Path: pluginPath} json, _ := json.MarshalIndent(self.plugins, "", " ") - ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json) + common.WriteFile(self.eth.DataDir+"/plugins.json", json) } func (self *Gui) RemovePlugin(pluginPath string) { delete(self.plugins, pluginPath) json, _ := json.MarshalIndent(self.plugins, "", " ") - ethutil.WriteFile(self.eth.DataDir+"/plugins.json", json) + common.WriteFile(self.eth.DataDir+"/plugins.json", json) } func (self *Gui) DumpState(hash, path string) { @@ -76,7 +67,7 @@ func (self *Gui) DumpState(hash, path string) { i, _ := strconv.Atoi(hash[1:]) block = self.eth.ChainManager().GetBlockByNumber(uint64(i)) } else { - block = self.eth.ChainManager().GetBlock(ethutil.Hex2Bytes(hash)) + block = self.eth.ChainManager().GetBlock(common.Hex2Bytes(hash)) } if block == nil { diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e50dfad14..19ad09454 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -35,7 +35,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/ui/qt/qwhisper" "github.com/ethereum/go-ethereum/xeth" @@ -91,7 +91,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui { plugins: make(map[string]plugin), serviceEvents: make(chan ServEv, 1), } - data, _ := ethutil.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json")) + data, _ := common.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) return gui @@ -198,7 +198,7 @@ func (gui *Gui) loadAddressBook() { it := nameReg.Trie().Iterator() for it.Next() { if it.Key[0] != 0 { - view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)}) + view.Call("addAddress", struct{ Name, Address string }{string(it.Key), common.Bytes2Hex(it.Value)}) } } @@ -219,7 +219,7 @@ func (self *Gui) loadMergedMiningOptions() { Checked bool Name, Address string Id, ItemId int - }{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i}) + }{false, string(it.Key), common.Bytes2Hex(it.Value), 0, i}) i++ @@ -238,8 +238,8 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { var ( ptx = xeth.NewTx(tx) - send = ethutil.Bytes2Hex(tx.From()) - rec = ethutil.Bytes2Hex(tx.To()) + send = common.Bytes2Hex(tx.From()) + rec = common.Bytes2Hex(tx.To()) ) ptx.Sender = send ptx.Address = rec @@ -263,7 +263,7 @@ func (gui *Gui) readPreviousTransactions() { } func (gui *Gui) processBlock(block *types.Block, initial bool) { - name := ethutil.Bytes2Hex(block.Coinbase()) + name := common.Bytes2Hex(block.Coinbase()) b := xeth.NewBlock(block) b.Name = name @@ -277,10 +277,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) { if unconfirmedFunds.Cmp(big.NewInt(0)) < 0 { pos = "-" } - val := ethutil.CurrencyToString(new(big.Int).Abs(ethutil.BigCopy(unconfirmedFunds))) - str = fmt.Sprintf("%v (%s %v)", ethutil.CurrencyToString(amount), pos, val) + val := common.CurrencyToString(new(big.Int).Abs(common.BigCopy(unconfirmedFunds))) + str = fmt.Sprintf("%v (%s %v)", common.CurrencyToString(amount), pos, val) } else { - str = fmt.Sprintf("%v", ethutil.CurrencyToString(amount)) + str = fmt.Sprintf("%v", common.CurrencyToString(amount)) } gui.win.Root().Call("setWalletValue", str) diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index e4ea57b9b..195e81073 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -30,7 +30,7 @@ import ( "path/filepath" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/xeth" "github.com/howeyc/fsnotify" "github.com/obscuren/qml" @@ -62,7 +62,7 @@ func (app *HtmlApplication) Create() error { return errors.New("Ethereum package not yet supported") // TODO - //ethutil.OpenPackage(app.path) + //common.OpenPackage(app.path) } win := component.CreateWindow(nil) @@ -80,7 +80,7 @@ func (app *HtmlApplication) RootFolder() string { if err != nil { return "" } - return path.Dir(ethutil.WindonizePath(folder.RequestURI())) + return path.Dir(common.WindonizePath(folder.RequestURI())) } func (app *HtmlApplication) RecursiveFolders() []os.FileInfo { files, _ := ioutil.ReadDir(app.RootFolder()) @@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window { } func (app *HtmlApplication) NewBlock(block *types.Block) { - b := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} + b := &xeth.Block{Number: int(block.NumberU64()), Hash: common.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 887eda59e..1c51233e3 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -29,7 +29,7 @@ import ( "github.com/codegangsta/cli" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/ui/qt/webengine" "github.com/obscuren/qml" @@ -45,7 +45,7 @@ var ( assetPathFlag = cli.StringFlag{ Name: "asset_path", Usage: "absolute path to GUI assets directory", - Value: ethutil.DefaultAssetPath(), + Value: common.DefaultAssetPath(), } ) diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 16a055bc0..778ef0e40 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -25,7 +25,7 @@ import ( "runtime" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -68,7 +68,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { // Events func (app *QmlApplication) NewBlock(block *types.Block) { - pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: ethutil.Bytes2Hex(block.Hash())} + pblock := &xeth.Block{Number: int(block.NumberU64()), Hash: common.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 42cdcb9d7..34ce56e77 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -24,9 +24,9 @@ import ( "io/ioutil" "path" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" @@ -71,7 +71,7 @@ func (self *UiLib) Notef(args []interface{}) { } func (self *UiLib) ImportTx(rlpTx string) { - tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) + tx := types.NewTransactionFromBytes(common.Hex2Bytes(rlpTx)) err := self.eth.TxPool().Add(tx) if err != nil { guilogger.Infoln("import tx failed ", err) @@ -126,15 +126,6 @@ func (self *UiLib) Transact(params map[string]interface{}) (string, error) { ) } -func (self *UiLib) Compile(code string) (string, error) { - bcode, err := ethutil.Compile(code, false) - if err != nil { - return err.Error(), err - } - - return ethutil.Bytes2Hex(bcode), err -} - func (self *UiLib) Call(params map[string]interface{}) (string, error) { object := mapToTxParams(params) @@ -152,8 +143,8 @@ func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) in return 0 /* return self.miner.AddLocalTx(&miner.LocalTx{ - To: ethutil.Hex2Bytes(to), - Data: ethutil.Hex2Bytes(data), + To: common.Hex2Bytes(to), + Data: common.Hex2Bytes(data), Gas: gas, GasPrice: gasPrice, Value: value, @@ -176,7 +167,7 @@ func (self *UiLib) ToggleMining() bool { } func (self *UiLib) ToHex(data string) string { - return "0x" + ethutil.Bytes2Hex([]byte(data)) + return "0x" + common.Bytes2Hex([]byte(data)) } func (self *UiLib) ToAscii(data string) string { @@ -184,7 +175,7 @@ func (self *UiLib) ToAscii(data string) string { if len(data) > 1 && data[0:2] == "0x" { start = 2 } - return string(ethutil.Hex2Bytes(data[start:])) + return string(common.Hex2Bytes(data[start:])) } /// Ethereum filter methods @@ -212,7 +203,7 @@ func (self *UiLib) NewFilterString(typ string, view *qml.Common) (id int) { return 0 } -func (self *UiLib) Messages(id int) *ethutil.List { +func (self *UiLib) Messages(id int) *common.List { /* TODO remove me filter := self.filterManager.GetFilter(id) if filter != nil { @@ -222,7 +213,7 @@ func (self *UiLib) Messages(id int) *ethutil.List { } */ - return ethutil.EmptyList() + return common.EmptyList() } func (self *UiLib) ReadFile(p string) string { @@ -264,14 +255,14 @@ func mapToTxParams(object map[string]interface{}) map[string]string { } for _, str := range data { - if ethutil.IsHex(str) { + if common.IsHex(str) { str = str[2:] if len(str) != 64 { - str = ethutil.LeftPadString(str, 64) + str = common.LeftPadString(str, 64) } } else { - str = ethutil.Bytes2Hex(ethutil.LeftPadBytes(ethutil.Big(str).Bytes(), 32)) + str = common.Bytes2Hex(common.LeftPadBytes(common.Big(str).Bytes(), 32)) } dataStr += str diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 6b99b841f..74fd5334e 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/rlp" ) @@ -62,7 +62,7 @@ func RunInterruptCallbacks(sig os.Signal) { } func openLogFile(Datadir string, filename string) *os.File { - path := ethutil.AbsolutePath(Datadir, filename) + path := common.AbsolutePath(Datadir, filename) file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { panic(fmt.Sprintf("error opening log file '%s': %v", filename, err)) @@ -132,10 +132,10 @@ func StartEthereumForTest(ethereum *eth.Ethereum) { } func FormatTransactionData(data string) []byte { - d := ethutil.StringToByteFunc(data, func(s string) (ret []byte) { + d := common.StringToByteFunc(data, func(s string) (ret []byte) { slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000) for _, dataItem := range slice { - d := ethutil.FormatData(dataItem) + d := common.FormatData(dataItem) ret = append(ret, d...) } return @@ -171,7 +171,7 @@ func ExportChain(chainmgr *core.ChainManager, fn string) error { data := chainmgr.Export() - if err := ethutil.WriteFile(fn, data); err != nil { + if err := common.WriteFile(fn, data); err != nil { return err } fmt.Printf("exported blockchain\n") diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 563654441..42256903e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -15,7 +15,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p/nat" @@ -87,7 +87,7 @@ var ( DataDirFlag = cli.StringFlag{ Name: "datadir", Usage: "Data directory to be used", - Value: ethutil.DefaultDataDir(), + Value: common.DefaultDataDir(), } MinerThreadsFlag = cli.IntFlag{ Name: "minerthreads", @@ -198,7 +198,7 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) { func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { return ð.Config{ - Name: ethutil.MakeName(clientID, version), + Name: common.MakeName(clientID, version), DataDir: ctx.GlobalString(DataDirFlag.Name), LogFile: ctx.GlobalString(LogFileFlag.Name), LogLevel: ctx.GlobalInt(LogLevelFlag.Name), @@ -216,7 +216,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { } } -func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database, ethutil.Database) { +func GetChain(ctx *cli.Context) (*core.ChainManager, common.Database, common.Database) { dataDir := ctx.GlobalString(DataDirFlag.Name) blockDb, err := ethdb.NewLDBDatabase(path.Join(dataDir, "blockchain")) if err != nil { |