Always return fully extended block in blocks API even if indexing is disabled

This commit is contained in:
nymkappa 2023-02-14 22:12:43 +09:00
parent 2b5442783e
commit 56dad33fce
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -609,7 +609,9 @@ class Blocks {
const transactions = await this.$getTransactionsExtended(blockHash, block.height, true);
const blockExtended = await this.$getBlockExtended(block, transactions);
await blocksRepository.$saveBlockInDatabase(blockExtended);
if (Common.indexingEnabled()) {
await blocksRepository.$saveBlockInDatabase(blockExtended);
}
return prepareBlock(blockExtended);
}
@ -713,7 +715,7 @@ class Blocks {
block = await this.$indexBlock(currentHeight);
returnBlocks.push(block);
} else if (nextHash != null) {
block = prepareBlock(await bitcoinClient.getBlock(nextHash));
block = await this.$indexBlock(currentHeight);
nextHash = block.previousblockhash;
returnBlocks.push(block);
}