From b113b56f62a368b8ff651f862e19920a5dfdeef1 Mon Sep 17 00:00:00 2001 From: Vyacheslav Date: Mon, 25 Mar 2024 13:13:09 +0200 Subject: [PATCH] do not limit client type to white list (#442) --- .../dshackle/upstream/LabelsDetector.kt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/LabelsDetector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/LabelsDetector.kt index 1b8d36c0..8debd08e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/LabelsDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/LabelsDetector.kt @@ -55,22 +55,12 @@ abstract class BasicEthLabelsDetector( } private fun clientType(client: String): String? { - return if (client.contains("erigon", true)) { - "erigon" - } else if (client.contains("geth", true)) { - "geth" - } else if (client.contains("bor", true)) { - "bor" - } else if (client.contains("nethermind", true)) { - "nethermind" - } else if (client.contains("prysm", true)) { - "prysm" - } else if (client.contains("lighthouse", true)) { - "lighthouse" - } else { + val firstSlash = client.indexOf("/") + if (firstSlash == -1) { log.debug("Unknown client type: {}", client) - null + return null } + return client.substring(0, firstSlash).lowercase() } data class NodeTypeRequest(