Skip to content

Commit ec5f531

Browse files
committed
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.
1 parent 37e5816 commit ec5f531

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

accounts/addrcache.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (ac *addrCache) scan() ([]Account, error) {
225225
buf = new(bufio.Reader)
226226
addrs []Account
227227
keyJSON struct {
228-
Address common.Address `json:"address"`
228+
Address string `json:"address"`
229229
}
230230
)
231231
for _, fi := range files {
@@ -241,15 +241,16 @@ func (ac *addrCache) scan() ([]Account, error) {
241241
}
242242
buf.Reset(fd)
243243
// Parse the address.
244-
keyJSON.Address = common.Address{}
244+
keyJSON.Address = ""
245245
err = json.NewDecoder(buf).Decode(&keyJSON)
246+
addr := common.HexToAddress(keyJSON.Address)
246247
switch {
247248
case err != nil:
248249
glog.V(logger.Debug).Infof("can't decode key %s: %v", path, err)
249-
case (keyJSON.Address == common.Address{}):
250+
case (addr == common.Address{}):
250251
glog.V(logger.Debug).Infof("can't decode key %s: missing or zero address", path)
251252
default:
252-
addrs = append(addrs, Account{Address: keyJSON.Address, File: path})
253+
addrs = append(addrs, Account{Address: addr, File: path})
253254
}
254255
fd.Close()
255256
}

0 commit comments

Comments
 (0)