eth/api: fix potential nil deref in AccountRange (#21710)

* Fix potential nil pointer error when neither block number nor hash is specified to accountRange

* Update error description
This commit is contained in:
aaronbuchwald 2020-10-20 14:19:21 -04:00 committed by GitHub
parent 9d25f34263
commit 3e82c9ef67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -389,6 +389,8 @@ func (api *PublicDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, sta
if err != nil { if err != nil {
return state.IteratorDump{}, err return state.IteratorDump{}, err
} }
} else {
return state.IteratorDump{}, errors.New("either block number or block hash must be specified")
} }
if maxResults > AccountRangeMaxResults || maxResults <= 0 { if maxResults > AccountRangeMaxResults || maxResults <= 0 {