Skip to content

Commit 4e68514

Browse files
authored
refactor(core-blockchain): process blocks log line (#3815)
1 parent d9fc0c0 commit 4e68514

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

__tests__/unit/core-blockchain/blockchain.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe("Blockchain", () => {
5858
logService.warning = jest.fn();
5959
logService.info = jest.fn();
6060
logService.error = jest.fn();
61+
logService.debug = jest.fn();
6162

6263
stateStore.started = false;
6364
stateStore.clearWakeUpTimeout = jest.fn();

packages/core-blockchain/src/blockchain.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ export class Blockchain implements Contracts.Blockchain.Blockchain {
354354
* Process the given block.
355355
*/
356356
public async processBlocks(blocks: Interfaces.IBlockData[]): Promise<Interfaces.IBlock[] | undefined> {
357+
if (blocks.length) {
358+
const lastHeight = this.getLastBlock().data.height;
359+
const fromHeight = blocks[0].height;
360+
const toHeight = blocks[blocks.length - 1].height;
361+
this.app.log.debug(`Processing chunk of blocks [${fromHeight}, ${toHeight}] on top of ${lastHeight}`);
362+
}
363+
357364
const blockTimeLookup = await Utils.forgingInfoCalculator.getBlockTimeLookup(this.app, blocks[0].height);
358365

359366
const acceptedBlocks: Interfaces.IBlock[] = [];

0 commit comments

Comments
 (0)