Skip to content

Commit

Permalink
chore: Fix blacklisted IP address handling in API
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulazeem-tk4vr committed Oct 21, 2024
1 parent f3415d6 commit 2066893
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,19 @@ async function injectAndRecordTx(
}> {
const { raw } = tx
let nodeIpPort: string, baseUrl: string

// Initialize them with some values({ nodeIpPort, baseUrl } = getBaseUrl())
;({ nodeIpPort, baseUrl } = getBaseUrl())

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

do {
;({ nodeIpPort, baseUrl } = getBaseUrl())
entry = blacklistedIPMapping.get(nodeIpPort)
if (entry !== undefined) console.log('The ip address blacklisted is', nodeIpPort)

if (entry !== undefined) {
console.log('The IP address blacklisted is', nodeIpPort)
// Reassign nodeIpPort and baseUrl to find a new pair
;({ nodeIpPort, baseUrl } = getBaseUrl())
}
} while (entry !== undefined)
}

Expand Down

0 comments on commit 2066893

Please sign in to comment.