Cleanup unneeded check in getBlockHeaders

This commit is contained in:
kdeme 2019-07-09 17:06:20 +02:00
parent 1797b76351
commit 646a58dbc0
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
1 changed files with 9 additions and 10 deletions

View File

@ -10,8 +10,7 @@ proc getBlockHeaders*(db: AbstractChainDB,
var foundBlock: BlockHeader var foundBlock: BlockHeader
if db.getBlockHeader(req.startBlock, foundBlock): if db.getBlockHeader(req.startBlock, foundBlock):
result.add foundBlock result.add foundBlock
# Quick sanity check for lower bounds, code should be safe though without.
if not req.reverse or (foundBlock.blockNumber >= (req.skip + 1).toBlockNumber):
while uint64(result.len) < req.maxResults: while uint64(result.len) < req.maxResults:
if not req.reverse: if not req.reverse:
if not db.getSuccessorHeader(foundBlock, foundBlock, req.skip): if not db.getSuccessorHeader(foundBlock, foundBlock, req.skip):