aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-28 08:30:54 +0800
committerFelix Lange <fjl@twurst.com>2016-11-28 18:37:13 +0800
commitec5f531f4b62b61d9636a03050af3453532a7b05 (patch)
treee3b97ac8fcc47b7a186299e1497c9d0c3fa86332 /accounts
parent37e5816bcdaaca2380ce5a56d9a0834340733b31 (diff)
downloaddexon-ec5f531f4b62b61d9636a03050af3453532a7b05.tar.gz
dexon-ec5f531f4b62b61d9636a03050af3453532a7b05.tar.zst
dexon-ec5f531f4b62b61d9636a03050af3453532a7b05.zip
accounts: don't use common.Address for address field
common.Address JSON encoding now enforces the 0x prefix, but key files don't have the prefix.
Diffstat (limited to 'accounts')
-rw-r--r--accounts/addrcache.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/accounts/addrcache.go b/accounts/addrcache.go
index 0a904f788..a99f23606 100644
--- a/accounts/addrcache.go
+++ b/accounts/addrcache.go
@@ -225,7 +225,7 @@ func (ac *addrCache) scan() ([]Account, error) {
buf = new(bufio.Reader)
addrs []Account
keyJSON struct {
- Address common.Address `json:"address"`
+ Address string `json:"address"`
}
)
for _, fi := range files {
@@ -241,15 +241,16 @@ func (ac *addrCache) scan() ([]Account, error) {
}
buf.Reset(fd)
// Parse the address.
- keyJSON.Address = common.Address{}
+ keyJSON.Address = ""
err = json.NewDecoder(buf).Decode(&keyJSON)
+ addr := common.HexToAddress(keyJSON.Address)
switch {
case err != nil:
glog.V(logger.Debug).Infof("can't decode key %s: %v", path, err)
- case (keyJSON.Address == common.Address{}):
+ case (addr == common.Address{}):
glog.V(logger.Debug).Infof("can't decode key %s: missing or zero address", path)
default:
- addrs = append(addrs, Account{Address: keyJSON.Address, File: path})
+ addrs = append(addrs, Account{Address: addr, File: path})
}
fd.Close()
}