Skip to content

Commit

Permalink
fix(core-p2p): convert isAppReady response to object (#3050)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodf authored and faustbrian committed Oct 10, 2019
1 parent 9a6de2d commit 892a610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/core-p2p/src/socket-server/versions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { isWhitelisted } from "../../utils/is-whitelisted";
import * as internalHandlers from "./internal";
import * as peerHandlers from "./peer";

export const isAppReady = (): boolean => {
return !!app.resolvePlugin("transaction-pool") && !!app.resolvePlugin("blockchain") && !!app.resolvePlugin("p2p");
export const isAppReady = (): { ready: boolean } => {
return {
ready:
!!app.resolvePlugin("transaction-pool") && !!app.resolvePlugin("blockchain") && !!app.resolvePlugin("p2p"),
};
};

export const getHandlers = (): { [key: string]: string[] } => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-p2p/src/socket-server/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Worker extends SCWorker {
}

// Check that blockchain, tx-pool and p2p are ready
const isAppReady: boolean = await this.sendToMasterAsync("p2p.utils.isAppReady");
const isAppReady: boolean = (await this.sendToMasterAsync("p2p.utils.isAppReady")).data.ready;
if (!isAppReady) {
req.socket.terminate();
return;
Expand Down

0 comments on commit 892a610

Please sign in to comment.