From 642dd0d3197d227d3e453c4c76f45ad9a55d9730 Mon Sep 17 00:00:00 2001 From: Wallace Luk Date: Wed, 3 Nov 2021 10:25:16 -0700 Subject: [PATCH] uniform round naming for consensus strategies --- .../strategies/mandatory-timer-strategy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/managers/consensus-manager/strategies/mandatory-timer-strategy.js b/src/managers/consensus-manager/strategies/mandatory-timer-strategy.js index c989b751..9ce31560 100644 --- a/src/managers/consensus-manager/strategies/mandatory-timer-strategy.js +++ b/src/managers/consensus-manager/strategies/mandatory-timer-strategy.js @@ -8,7 +8,9 @@ export default function mandatoryTimerStrategy(consensusGroup, strategyOptions) defaultActions: [], maxRounds: Infinity, name: (list)=> { - return `round-${list.length + 1}`; + const NUMBER_SIZE = 3; + const number = `${list.length + 1}`.padStart(NUMBER_SIZE, '0'); + return `round-${number}`; } }, strategyOptions); return consensusGroup.list().then((consensusList)=> { @@ -24,7 +26,7 @@ export default function mandatoryTimerStrategy(consensusGroup, strategyOptions) const newConsensusPromise = consensusGroup.consensus(name).create({ roles: options.roles, executeActionsImmediately: false - }); + }); return newConsensusPromise; }); } \ No newline at end of file