From 0e8d41ee81b3264e44fbe3d4f8c195620015f2e1 Mon Sep 17 00:00:00 2001 From: George Avsetsin Date: Fri, 14 Jun 2024 11:03:45 +0300 Subject: [PATCH] fix: joining messages highlinting --- programs/staking-module/simple-dvt.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/programs/staking-module/simple-dvt.ts b/programs/staking-module/simple-dvt.ts index e0aa484..70d50bc 100644 --- a/programs/staking-module/simple-dvt.ts +++ b/programs/staking-module/simple-dvt.ts @@ -256,10 +256,10 @@ 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); @@ -267,7 +267,7 @@ export const checkSignatures = async (clusterName: string, addresses: string[]) } else { signedMessages.map(({ message, signature }) => { logger.log(''); - logger.log('Message: ', message); + logger.log('Message: ', chalk.yellow(message)); logger.log('Signature:', signature); }); } @@ -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'); +};