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
if args.From == nil {
key, exist := checkKeyInKeyring(e.keys, *args.From)
if exist {
addr = common.BytesToAddress(key.PubKey().Address().Bytes())
addrs, err := e.Accounts()
if err == nil && len(addrs) > 0 {
addr = addrs[0]
}
// No error handled here intentionally to match geth behaviour
} else {
addr = *args.From
}