Skip to content

Commit

Permalink
Refactor NodeList module to handle empty node list case in getCachedN…
Browse files Browse the repository at this point in the history
…odeList function
  • Loading branch information
tanuj-shardeum authored and jairajdev committed May 14, 2024
1 parent 41c86d5 commit 48dacfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NodeList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const getCachedNodeList = (): SignedNodeList => {

for (let index = 0; index < config.N_RANDOM_NODELIST_BUCKETS; index++) {
// If we dont have any active nodes, send back the first node in our list
const nodeList = nodeCount < 1 ? [getFirstNode()] : getRandomActiveNodes(nodeCount)
const nodeList = nodeCount < 1 ? (isEmpty() ? [] : [getFirstNode()]) : getRandomActiveNodes(nodeCount);
const sortedNodeList = [...nodeList].sort(byAscendingNodeId)
const signedSortedNodeList = Crypto.sign({
nodeList: sortedNodeList,
Expand Down

0 comments on commit 48dacfe

Please sign in to comment.