mirror of https://github.com/status-im/nim-eth.git
Merge pull request #79 from status-im/removecheck
Cleanup unneeded check in getBlockHeaders
This commit is contained in:
commit
da5a7a54ed
|
@ -10,16 +10,15 @@ 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):
|
break
|
||||||
break
|
else:
|
||||||
else:
|
if not db.getAncestorHeader(foundBlock, foundBlock, req.skip):
|
||||||
if not db.getAncestorHeader(foundBlock, foundBlock, req.skip):
|
break
|
||||||
break
|
result.add foundBlock
|
||||||
result.add foundBlock
|
|
||||||
|
|
||||||
|
|
||||||
template fetcher*(fetcherName, fetchingFunc, InputType, ResultType: untyped) =
|
template fetcher*(fetcherName, fetchingFunc, InputType, ResultType: untyped) =
|
||||||
|
|
Loading…
Reference in New Issue