Skip to content

Commit

Permalink
fix node indexes response for existing users
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu committed Sep 27, 2023
1 parent 126ca8f commit 3188a95
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ export const GetPubKeyOrKeyAssign = async (params: {
if (keyResult) {
lookupResults.forEach((x1) => {
if (x1 && x1.result) {
const nodeIndex = parseInt(x1.result.node_index);
if (nodeIndex) nodeIndexes.push(nodeIndex);
const currentNodePubKey = x1.result.keys[0].pub_key_X.toLowerCase();
const thresholdPubKey = keyResult.keys[0].pub_key_X.toLowerCase();
// push only those indexes for nodes who are returning pub key matching with threshold pub key.
// this check is important when different nodes have different keys assigned to a user.
if (currentNodePubKey === thresholdPubKey) {
const nodeIndex = parseInt(x1.result.node_index);
if (nodeIndex) nodeIndexes.push(nodeIndex);
}
}
});
}
Expand Down

0 comments on commit 3188a95

Please sign in to comment.