From fc2354f9c3b63e7e52308fc636aaa24f77c646ac Mon Sep 17 00:00:00 2001 From: KirillPamPam Date: Wed, 26 Jul 2023 19:31:59 +0400 Subject: [PATCH] Handle unknown chain (#260) --- .../io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt index bb01da3e..659a9cb5 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt @@ -21,6 +21,7 @@ import io.emeraldpay.api.proto.BlockchainOuterClass.DescribeRequest import io.emeraldpay.api.proto.BlockchainOuterClass.DescribeResponse import io.emeraldpay.api.proto.BlockchainOuterClass.StatusRequest import io.emeraldpay.api.proto.Common +import io.emeraldpay.api.proto.Common.ChainRef.UNRECOGNIZED import io.emeraldpay.api.proto.ReactorBlockchainGrpc import io.emeraldpay.dshackle.BlockchainType import io.emeraldpay.dshackle.Chain @@ -151,10 +152,15 @@ class GrpcUpstreams( private fun processDescription(value: DescribeResponse): Flux { val chainNames = value.chainsList.map { it.chain.name } + .also { + if (it.contains("UNRECOGNIZED")) { + log.warn("There is an UNRECOGNIZED chain, it's necessary to update dshackle-main") + } + } val version = value.buildInfo.version log.info("Start processing grpc upstream description for $id with chains $chainNames and version $version") val current = value.chainsList.filter { - Chain.byId(it.chain.number) != Chain.UNSPECIFIED + it.chain != UNRECOGNIZED && Chain.byId(it.chain.number) != Chain.UNSPECIFIED }.mapNotNull { chainDetails -> try { val chain = Chain.byId(chainDetails.chain.number)