diff --git a/lib/DataFinder.ts b/lib/DataFinder.ts index 34d36c52a276ba903363218c625b3a9a960d887c..8f63faa518688e331711fa7957a1db60f358a266 100644 --- a/lib/DataFinder.ts +++ b/lib/DataFinder.ts @@ -127,8 +127,8 @@ export class DataFinder { } @MonitorExecutionTime() - getBlockWhereMedianTimeLteAnd(medianTime: number, previousBlockchainTime: number) { - return this.getFromCacheOrDB('getBlockWhereMedianTimeLteAnd', [medianTime, previousBlockchainTime].join('-'), + getBlockWhereMedianTimeLteAndGt(medianTime: number, previousBlockchainTime: number) { + return this.getFromCacheOrDB('getBlockWhereMedianTimeLteAndGt', [medianTime, previousBlockchainTime].join('-'), () => this.query('SELECT `issuer`,`membersCount`,`medianTime`,`dividend`,`number`,`nonce` FROM block WHERE `fork`=0 AND `medianTime` <= '+medianTime+' AND `medianTime` > '+previousBlockchainTime+' ORDER BY `medianTime` ASC')) } } diff --git a/routes/blockCount2.ts b/routes/blockCount2.ts index a2e15149fc730f10e5bbead9c0c00b14ad76e73a..a92abb500498b939f5c69437f34336eabcdbd4b6 100755 --- a/routes/blockCount2.ts +++ b/routes/blockCount2.ts @@ -56,7 +56,7 @@ module.exports = async (req: any, res: any, next: any) => { } else if (end > blockchain.length) { - newBlocks = await dataFinder.getBlockWhereMedianTimeLteAnd(endBlock.medianTime, previousBlockchainTime) + newBlocks = await dataFinder.getBlockWhereMedianTimeLteAndGt(endBlock.medianTime, previousBlockchainTime) for (let i=0;i<newBlocks.length;i++) { @@ -434,4 +434,4 @@ interface BlockMemberWithPerNode extends BlockMember { coreCountPerNode: number[]|null blockCountPerNode: number[]|null dataPerNode: number[]|null -} \ No newline at end of file +}