Skip to content

Commit

Permalink
fix(dashmate): restart platform waits for DKG (#1944)
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov authored Jul 16, 2024
1 parent d03e2ca commit 86b7b39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/dashmate/src/commands/restart.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default class RestartCommand extends ConfigBaseCommand {
static flags = {
...ConfigBaseCommand.flags,
platform: Flags.boolean({ char: 'p', description: 'restart only platform', default: false }),
safe: Flags.boolean({ char: 's', description: 'wait for dkg before stop', default: false }),
safe: Flags.boolean({ char: 's', description: 'wait for DKG before stop', default: false }),
force: Flags.boolean({ char: 'f', description: 'ignore DKG (masternode might be banned)', default: false }),
};

/**
Expand All @@ -27,6 +28,7 @@ export default class RestartCommand extends ConfigBaseCommand {
verbose: isVerbose,
platform: platformOnly,
safe: isSafe,
force: isForce,
},
dockerCompose,
restartNodeTask,
Expand Down Expand Up @@ -54,6 +56,7 @@ export default class RestartCommand extends ConfigBaseCommand {
await tasks.run({
isVerbose,
isSafe,
isForce,
platformOnly: platformOnly === true,
});
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/src/commands/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class StopCommand extends ConfigBaseCommand {
...ConfigBaseCommand.flags,
force: Flags.boolean({
char: 'f',
description: 'force stop even if any service is running',
description: 'force stop even if any service is running or DKG is in progress',
default: false,
}),
platform: Flags.boolean({
Expand Down
4 changes: 2 additions & 2 deletions packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function stopNodeTaskFactory(
},
{
title: 'Check node is participating in DKG',
enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && !ctx.isSafe,
enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && !ctx.isSafe && !ctx.platformOnly,
task: async () => {
const rpcClient = createRpcClient({
port: config.get('core.rpc.port'),
Expand All @@ -59,7 +59,7 @@ export default function stopNodeTaskFactory(
},
{
title: 'Wait for DKG window to pass',
enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && ctx.isSafe,
enabled: (ctx) => config.get('core.masternode.enable') && !ctx.isForce && ctx.isSafe && !ctx.platformOnly,
task: async () => waitForDKGWindowPass(createRpcClient({
port: config.get('core.rpc.port'),
user: 'dashmate',
Expand Down

0 comments on commit 86b7b39

Please sign in to comment.