Merge pull request #3080 from mempool/nymkappa/bugfix/invalid-db-use
Fix database usage when database is disabled
This commit is contained in:
commit
ee6bdeec66
@ -600,10 +600,12 @@ class Blocks {
|
||||
* Index a block if it's missing from the database. Returns the block after indexing
|
||||
*/
|
||||
public async $indexBlock(height: number): Promise<BlockExtended> {
|
||||
if (Common.indexingEnabled()) {
|
||||
const dbBlock = await blocksRepository.$getBlockByHeight(height);
|
||||
if (dbBlock != null) {
|
||||
if (dbBlock !== null) {
|
||||
return prepareBlock(dbBlock);
|
||||
}
|
||||
}
|
||||
|
||||
const blockHash = await bitcoinApi.$getBlockHash(height);
|
||||
const block = BitcoinApi.convertBlock(await bitcoinClient.getBlock(blockHash));
|
||||
|
Loading…
x
Reference in New Issue
Block a user