Skip to content

Commit

Permalink
refactor(core-blockchain): process blocks log line (#3815)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainydio authored Jun 19, 2020
1 parent d9fc0c0 commit 4e68514
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions __tests__/unit/core-blockchain/blockchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe("Blockchain", () => {
logService.warning = jest.fn();
logService.info = jest.fn();
logService.error = jest.fn();
logService.debug = jest.fn();

stateStore.started = false;
stateStore.clearWakeUpTimeout = jest.fn();
Expand Down
7 changes: 7 additions & 0 deletions packages/core-blockchain/src/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ export class Blockchain implements Contracts.Blockchain.Blockchain {
* Process the given block.
*/
public async processBlocks(blocks: Interfaces.IBlockData[]): Promise<Interfaces.IBlock[] | undefined> {
if (blocks.length) {
const lastHeight = this.getLastBlock().data.height;
const fromHeight = blocks[0].height;
const toHeight = blocks[blocks.length - 1].height;
this.app.log.debug(`Processing chunk of blocks [${fromHeight}, ${toHeight}] on top of ${lastHeight}`);
}

const blockTimeLookup = await Utils.forgingInfoCalculator.getBlockTimeLookup(this.app, blocks[0].height);

const acceptedBlocks: Interfaces.IBlock[] = [];
Expand Down

0 comments on commit 4e68514

Please sign in to comment.