Skip to content

Commit

Permalink
fix(ptokens-node-selector): uses setSelectedNode when defaultNode is …
Browse files Browse the repository at this point in the history
…used
  • Loading branch information
allemanfredi committed Sep 11, 2021
1 parent 12eee15 commit 44e8c7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/ptokens-node-selector/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ export class NodeSelector {
const index = Math.floor(Math.random() * filteredNodesByFeature.length)
const selectedNode = filteredNodesByFeature[index]
if (
(await this.checkConnection(selectedNode.webapi, timeout || 30000, {
await this.checkConnection(selectedNode.webapi, timeout || 30000, {
pToken: optionalPtoken,
nativeNetwork: optionalNativeNetwork,
nativeBlockchain: optionalNativeBlockchain,
hostNetwork: optionalHostNetwork,
hostBlockchain: optionalHostBlockchain
})) &&
}) &&
!nodesNotReachable.includes(selectedNode)
) {
return this.setSelectedNode(selectedNode.webapi, {
Expand Down Expand Up @@ -165,7 +165,7 @@ export class NodeSelector {
this.nativeBlockchain = nativeBlockchain
this.nativeNetwork = nativeNetwork

this.selectedNode = defaultNode || null
this.selectedNode = defaultNode ? this.setSelectedNode(defaultNode) : null
}

/**
Expand Down

0 comments on commit 44e8c7c

Please sign in to comment.