diff --git a/routes/blockCount2.ts b/routes/blockCount2.ts index 3f8bf888a30150ca9668df1c23320067bf1b187b..f454aad84d4d870cce813d21582753957460aa19 100755 --- a/routes/blockCount2.ts +++ b/routes/blockCount2.ts @@ -35,7 +35,7 @@ module.exports = async (req: any, res: any, next: any) => { // detect fork if ( blockchain.length > 0 ) { - let newHashPreviousCurrentblock = (await dataFinder.getBlock(blockchain.length - 1) as { hash: string }).hash + let newHashPreviousCurrentblock = (await dataFinder.getCurrentBlockOrNull() as { hash: string }).hash if ( hashPreviousCurrentblock != newHashPreviousCurrentblock ) { blockchain.splice(0, blockchain.length); @@ -65,7 +65,7 @@ module.exports = async (req: any, res: any, next: any) => { } // stock hashPreviousCurrentblock and previousBlockchainTime - let tmpCurrentBlock = await dataFinder.getBlock(blockchain.length - 1) as DBBlock + let tmpCurrentBlock = await dataFinder.getCurrentBlockOrNull() as DBBlock hashPreviousCurrentblock = tmpCurrentBlock.hash; previousBlockchainTime = tmpCurrentBlock.medianTime;