Skip to content

Commit 2066893

Browse files
chore: Fix blacklisted IP address handling in API
1 parent f3415d6 commit 2066893

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/api.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,17 +582,19 @@ async function injectAndRecordTx(
582582
}> {
583583
const { raw } = tx
584584
let nodeIpPort: string, baseUrl: string
585-
586-
// Initialize them with some values({ nodeIpPort, baseUrl } = getBaseUrl())
585+
;({ nodeIpPort, baseUrl } = getBaseUrl())
587586

588587
if (config.enableBlacklistingIP) {
589-
// Continuously reassign nodeIpPort and baseUrl until a non-blacklisted one is found
590588
let entry
591589

592590
do {
593-
;({ nodeIpPort, baseUrl } = getBaseUrl())
594591
entry = blacklistedIPMapping.get(nodeIpPort)
595-
if (entry !== undefined) console.log('The ip address blacklisted is', nodeIpPort)
592+
593+
if (entry !== undefined) {
594+
console.log('The IP address blacklisted is', nodeIpPort)
595+
// Reassign nodeIpPort and baseUrl to find a new pair
596+
;({ nodeIpPort, baseUrl } = getBaseUrl())
597+
}
596598
} while (entry !== undefined)
597599
}
598600

0 commit comments

Comments
 (0)