Merge pull request #2851 from mempool/nymkappa/bugfix/error-500-blocks-list

Fix error 500 when querying /blocks using `"INDEXING_BLOCKS_AMOUNT": 0`
This commit is contained in:
softsimon 2023-01-05 01:16:09 +04:00 committed by GitHub
commit 05a8154db0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -677,7 +677,7 @@ class Blocks {
}
public async $getBlocks(fromHeight?: number, limit: number = 15): Promise<BlockExtended[]> {
let currentHeight = fromHeight !== undefined ? fromHeight : await blocksRepository.$mostRecentBlockHeight();
let currentHeight = fromHeight !== undefined ? fromHeight : this.currentBlockHeight;
const returnBlocks: BlockExtended[] = [];
if (currentHeight < 0) {