Skip to content

Commit

Permalink
fix(core-forger): ignore overheight block (#2687)
Browse files Browse the repository at this point in the history
  • Loading branch information
spkjp authored and faustbrian committed Jun 12, 2019
1 parent 5c9f8cc commit 72dc441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 5 additions & 3 deletions __tests__/unit/core-forger/manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ describe("Forger Manager", () => {
setTimeout(() => forgeManager.stopForging(), 1000);
await forgeManager.checkSlot();

expect(forgeManager.client.emitEvent).toHaveBeenCalledWith(ApplicationEvents.ForgerFailed, { error: "oh bollocks" });
expect(forgeManager.client.emitEvent).toHaveBeenCalledWith(ApplicationEvents.ForgerFailed, {
error: "oh bollocks",
});
});
});

Expand Down Expand Up @@ -144,7 +146,7 @@ describe("Forger Manager", () => {
expect(canForge).toBeFalse();
});

it("should be FAIL and detect possible double forging", async () => {
it("should be TRUE and detect possible double forging", async () => {
forgeManager.usernames = [];

const networkState = new NetworkState(NetworkStateStatus.Default);
Expand All @@ -164,7 +166,7 @@ describe("Forger Manager", () => {
});

const canForge = await forgeManager.isForgingAllowed(networkState, delegate);
expect(canForge).toBeFalse();
expect(canForge).toBeTrue();
});
});
});
12 changes: 2 additions & 10 deletions packages/core-forger/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ export class ForgerManager {
}> = networkState.getOverHeightBlockHeaders();
if (overHeightBlockHeaders.length > 0) {
this.logger.info(
`Detected ${overHeightBlockHeaders.length} distinct overheight block ${pluralize(
"header",
overHeightBlockHeaders.length,
true,
)}.`,
`Detected ${pluralize("distinct overheight block header", overHeightBlockHeaders.length, true)}.`,
);

for (const overHeightBlockHeader of overHeightBlockHeaders) {
Expand All @@ -226,12 +222,8 @@ export class ForgerManager {
this.logger.warn(
`Possible double forging delegate: ${username} (${delegate.publicKey}) - Block: ${
overHeightBlockHeader.id
}. Will not forge.`,
}.`,
);

this.logger.debug(`Network State: ${networkState.toJson()}`);

return false;
}
}
}
Expand Down

0 comments on commit 72dc441

Please sign in to comment.