aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /cmd
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloadgo-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'cmd')
-rw-r--r--cmd/disasm/main.go4
-rw-r--r--cmd/ethereum/blocktest.go4
-rw-r--r--cmd/ethereum/js.go6
-rw-r--r--cmd/ethereum/main.go6
-rw-r--r--cmd/ethtest/main.go32
-rw-r--r--cmd/evm/main.go12
-rw-r--r--cmd/mist/bindings.go14
-rw-r--r--cmd/mist/gui.go20
-rw-r--r--cmd/mist/html_container.go8
-rw-r--r--cmd/mist/main.go4
-rw-r--r--cmd/mist/qml_container.go4
-rw-r--r--cmd/mist/ui_lib.go26
-rw-r--r--cmd/utils/cmd.go10
-rw-r--r--cmd/utils/flags.go8
14 files changed, 79 insertions, 79 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/js.go b/cmd/ethereum/js.go
index 3b98b588e..a3c5f5d2d 100644
--- a/cmd/ethereum/js.go
+++ b/cmd/ethereum/js.go
@@ -27,7 +27,7 @@ import (
"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/javascript"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
@@ -226,7 +226,7 @@ func (self *jsre) dump(call otto.FunctionCall) otto.Value {
block = self.ethereum.ChainManager().GetBlockByNumber(uint64(num))
} else if call.Argument(0).IsString() {
hash, _ := call.Argument(0).ToString()
- block = self.ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(hash))
+ block = self.ethereum.ChainManager().GetBlock(common.Hex2Bytes(hash))
} else {
fmt.Println("invalid argument for dump. Either hex string or number")
}
@@ -285,7 +285,7 @@ func (self *jsre) export(call otto.FunctionCall) otto.Value {
data := self.ethereum.ChainManager().Export()
- if err := ethutil.WriteFile(fn, data); err != nil {
+ if err := common.WriteFile(fn, data); err != nil {
fmt.Println(err)
return otto.FalseValue()
}
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 53746627a..1efea927f 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"
@@ -200,7 +200,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)
}
@@ -284,7 +284,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..1371c752c 100644
--- a/cmd/mist/bindings.go
+++ b/cmd/mist/bindings.go
@@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/state"
)
@@ -39,13 +39,13 @@ 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)
+ code, err := common.Compile(d, false)
if err != nil {
return "", err
}
- data = ethutil.Bytes2Hex(code)
+ data = common.Bytes2Hex(code)
} else {
- data = ethutil.Bytes2Hex(utils.FormatTransactionData(d))
+ data = common.Bytes2Hex(utils.FormatTransactionData(d))
}
return gui.xeth.Transact(from, recipient, value, gas, gasPrice, data)
@@ -55,14 +55,14 @@ 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 +76,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 a49e9f6f8..476b441c8 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -37,7 +37,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"
@@ -93,7 +93,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
@@ -200,7 +200,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)})
}
}
@@ -221,7 +221,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++
@@ -240,8 +240,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
@@ -265,7 +265,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
@@ -279,10 +279,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 4116783c9..256c08691 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 cc213b49a..b33b81267 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -27,7 +27,7 @@ import (
"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/event/filter"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/xeth"
@@ -69,7 +69,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)
@@ -138,12 +138,12 @@ func (self *UiLib) Transact(params map[string]interface{}) (string, error) {
}
func (self *UiLib) Compile(code string) (string, error) {
- bcode, err := ethutil.Compile(code, false)
+ bcode, err := common.Compile(code, false)
if err != nil {
return err.Error(), err
}
- return ethutil.Bytes2Hex(bcode), err
+ return common.Bytes2Hex(bcode), err
}
func (self *UiLib) Call(params map[string]interface{}) (string, error) {
@@ -163,8 +163,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,
@@ -187,7 +187,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 {
@@ -195,7 +195,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
@@ -223,7 +223,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 {
@@ -233,7 +233,7 @@ func (self *UiLib) Messages(id int) *ethutil.List {
}
*/
- return ethutil.EmptyList()
+ return common.EmptyList()
}
func (self *UiLib) ReadFile(p string) string {
@@ -275,14 +275,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 6bcd7e811..95666e3c9 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",
@@ -193,7 +193,7 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) {
func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
return &eth.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),
@@ -211,7 +211,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 {