diff --git a/fearless/Common/Services/ChainRegistry/ConnectionPool/ConnectionPool.swift b/fearless/Common/Services/ChainRegistry/ConnectionPool/ConnectionPool.swift index 669f647041..b09f7027da 100644 --- a/fearless/Common/Services/ChainRegistry/ConnectionPool/ConnectionPool.swift +++ b/fearless/Common/Services/ChainRegistry/ConnectionPool/ConnectionPool.swift @@ -65,12 +65,18 @@ extension ConnectionPool: ConnectionPoolProtocol { } var chainFailedUrls = getFailedUrls(for: chain.chainId).or([]) - let node = chain.selectedNode ?? chain.nodes - .first(where: { - ($0.url != ignoredUrl) && !chainFailedUrls.contains($0.url) - }) chainFailedUrls.insert(ignoredUrl) +// If all available nodes are in blacklist => Remove all nodes except last one checked + if chainFailedUrls.count == chain.nodes.count { + lock.exclusivelyWrite { [weak self] in + self?.failedUrls[chain.chainId] = [ignoredUrl] + } + } + let node = chain.selectedNode ?? chain.nodes.first(where: { + ($0.url != ignoredUrl) && !chainFailedUrls.contains($0.url) + }) + lock.exclusivelyWrite { [weak self] in self?.failedUrls[chain.chainId] = chainFailedUrls }