Fix chain divergence detection upon new block (use the new interface)

This commit is contained in:
nymkappa
2023-03-01 13:50:15 +09:00
parent 76ae9d4ccb
commit a67656389e
2 changed files with 16 additions and 9 deletions

View File

@@ -525,8 +525,15 @@ class BlocksRepository {
public async $validateChain(): Promise<boolean> {
try {
const start = new Date().getTime();
const [blocks]: any[] = await DB.query(`SELECT height, hash, previous_block_hash,
UNIX_TIMESTAMP(blockTimestamp) as timestamp FROM blocks ORDER BY height`);
const [blocks]: any[] = await DB.query(`
SELECT
height,
hash,
previous_block_hash,
UNIX_TIMESTAMP(blockTimestamp) AS timestamp
FROM blocks
ORDER BY height
`);
let partialMsg = false;
let idx = 1;