Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core-forger): ignore overheight block #2687

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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