accounts/keystore: sort accounts in AmbiguousAddrError

This fixes a failing cmd/geth test. AmbiguousAddrErrors are created in
find, which uses ac.all or byAddr[addr]. ac.all is always sorted, but
byAddr[addr] might not be.
This commit is contained in:
Felix Lange 2017-10-07 00:06:01 +02:00
parent b65482fac2
commit aa798d6c94

View file

@ -194,6 +194,7 @@ func (ac *accountCache) find(a accounts.Account) (accounts.Account, error) {
default:
err := &AmbiguousAddrError{Addr: a.Address, Matches: make([]accounts.Account, len(matches))}
copy(err.Matches, matches)
sort.Sort(accountsByURL(err.Matches))
return accounts.Account{}, err
}
}