aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-03 03:14:25 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:19:39 +0800
commitda9fe951da4005761a014316c46771d628dc058e (patch)
treed5344172ed915b4890d66c3cf3b4181e30589471 /cmd
parent6b23094cff77d7e485e0a2ae5698884f63c87ce7 (diff)
downloadgo-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.gz
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.zst
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.zip
Use common.Address type for accounts.Address
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/admin.go4
-rw-r--r--cmd/geth/js.go3
-rw-r--r--cmd/geth/main.go9
-rw-r--r--cmd/mist/gui.go2
4 files changed, 9 insertions, 9 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index b0cb7507a..949a7bde0 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -391,7 +391,7 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
}
}
am := js.ethereum.AccountManager()
- err = am.TimedUnlock(common.FromHex(addr), passphrase, time.Duration(seconds)*time.Second)
+ err = am.TimedUnlock(common.HexToAddress(addr), passphrase, time.Duration(seconds)*time.Second)
if err != nil {
fmt.Printf("Unlock account failed '%v'\n", err)
return otto.FalseValue()
@@ -433,7 +433,7 @@ func (js *jsre) newAccount(call otto.FunctionCall) otto.Value {
fmt.Printf("Could not create the account: %v", err)
return otto.UndefinedValue()
}
- return js.re.ToVal(common.ToHex(acct.Address))
+ return js.re.ToVal(acct.Address.Hex())
}
func (js *jsre) nodeInfo(call otto.FunctionCall) otto.Value {
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 61e97433a..4ddb3bd9c 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -26,6 +26,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/cmd/utils"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/docserver"
"github.com/ethereum/go-ethereum/common/natspec"
"github.com/ethereum/go-ethereum/eth"
@@ -164,7 +165,7 @@ func (self *jsre) UnlockAccount(addr []byte) bool {
return false
}
// TODO: allow retry
- if err := self.ethereum.AccountManager().Unlock(addr, pass); err != nil {
+ if err := self.ethereum.AccountManager().Unlock(common.BytesToAddress(addr), pass); err != nil {
return false
} else {
fmt.Println("Account is now unlocked for this session.")
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 5fe83a2a0..dbcfe8175 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -365,11 +365,10 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass
// Load startup keys. XXX we are going to need a different format
// Attempt to unlock the account
passphrase = getPassPhrase(ctx, "", false)
- accbytes := common.FromHex(account)
- if len(accbytes) == 0 {
+ if len(account) == 0 {
utils.Fatalf("Invalid account address '%s'", account)
}
- err = am.Unlock(accbytes, passphrase)
+ err = am.Unlock(common.StringToAddress(account), passphrase)
if err != nil {
utils.Fatalf("Unlock account failed '%v'", err)
}
@@ -385,11 +384,11 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
account := ctx.GlobalString(utils.UnlockedAccountFlag.Name)
if len(account) > 0 {
if account == "primary" {
- accbytes, err := am.Primary()
+ primaryAcc, err := am.Primary()
if err != nil {
utils.Fatalf("no primary account: %v", err)
}
- account = common.ToHex(accbytes)
+ account = primaryAcc.Hex()
}
unlockAccount(ctx, am, account)
}
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 53194ae50..f443bacbc 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -232,7 +232,7 @@ func (self *Gui) loadMergedMiningOptions() {
func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
var inout string
from, _ := tx.From()
- if gui.eth.AccountManager().HasAccount(common.Hex2Bytes(from.Hex())) {
+ if gui.eth.AccountManager().HasAccount(from) {
inout = "send"
} else {
inout = "recv"