Skip to content

Commit

Permalink
fix: joining messages highlinting
Browse files Browse the repository at this point in the history
  • Loading branch information
avsetsin committed Jun 14, 2024
1 parent f04cd7c commit 0e8d41e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions programs/staking-module/simple-dvt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ export const checkSignatures = async (clusterName: string, addresses: string[])
continue;
}

const signedClusterMessages = signedMessages.filter(({ message }) => message.includes(clusterName));
const joiningMessages = signedMessages.filter(({ message }) => isJoiningMessage(message, clusterName));

if (signedClusterMessages.length) {
signedClusterMessages.map(({ message, signature }) => {
if (joiningMessages.length) {
joiningMessages.map(({ message, signature }) => {
logger.log('');
logger.log('Message: ', chalk.green(message));
logger.log('Signature:', signature);
});
} else {
signedMessages.map(({ message, signature }) => {
logger.log('');
logger.log('Message: ', message);
logger.log('Message: ', chalk.yellow(message));
logger.log('Signature:', signature);
});
}
Expand All @@ -281,3 +281,7 @@ export const checkSignatures = async (clusterName: string, addresses: string[])
}
}
};

const isJoiningMessage = (message: string, clusterName: string) => {
return message.includes(clusterName) && message.includes('is joining');
};

0 comments on commit 0e8d41e

Please sign in to comment.