fix doCall if args.From is nil (#518)

This commit is contained in:
noot 2020-09-21 11:59:07 -04:00 committed by GitHub
parent fe99e7e493
commit 0d545939d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -517,11 +517,10 @@ func (e *PublicEthAPI) doCall(
var addr common.Address var addr common.Address
if args.From == nil { if args.From == nil {
key, exist := checkKeyInKeyring(e.keys, *args.From) addrs, err := e.Accounts()
if exist { if err == nil && len(addrs) > 0 {
addr = common.BytesToAddress(key.PubKey().Address().Bytes()) addr = addrs[0]
} }
// No error handled here intentionally to match geth behaviour
} else { } else {
addr = *args.From addr = *args.From
} }