Handle unknown chain (#260)
This commit is contained in:
@@ -21,6 +21,7 @@ import io.emeraldpay.api.proto.BlockchainOuterClass.DescribeRequest
|
|||||||
import io.emeraldpay.api.proto.BlockchainOuterClass.DescribeResponse
|
import io.emeraldpay.api.proto.BlockchainOuterClass.DescribeResponse
|
||||||
import io.emeraldpay.api.proto.BlockchainOuterClass.StatusRequest
|
import io.emeraldpay.api.proto.BlockchainOuterClass.StatusRequest
|
||||||
import io.emeraldpay.api.proto.Common
|
import io.emeraldpay.api.proto.Common
|
||||||
|
import io.emeraldpay.api.proto.Common.ChainRef.UNRECOGNIZED
|
||||||
import io.emeraldpay.api.proto.ReactorBlockchainGrpc
|
import io.emeraldpay.api.proto.ReactorBlockchainGrpc
|
||||||
import io.emeraldpay.dshackle.BlockchainType
|
import io.emeraldpay.dshackle.BlockchainType
|
||||||
import io.emeraldpay.dshackle.Chain
|
import io.emeraldpay.dshackle.Chain
|
||||||
@@ -151,10 +152,15 @@ class GrpcUpstreams(
|
|||||||
|
|
||||||
private fun processDescription(value: DescribeResponse): Flux<UpstreamChangeEvent> {
|
private fun processDescription(value: DescribeResponse): Flux<UpstreamChangeEvent> {
|
||||||
val chainNames = value.chainsList.map { it.chain.name }
|
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
|
val version = value.buildInfo.version
|
||||||
log.info("Start processing grpc upstream description for $id with chains $chainNames and version $version")
|
log.info("Start processing grpc upstream description for $id with chains $chainNames and version $version")
|
||||||
val current = value.chainsList.filter {
|
val current = value.chainsList.filter {
|
||||||
Chain.byId(it.chain.number) != Chain.UNSPECIFIED
|
it.chain != UNRECOGNIZED && Chain.byId(it.chain.number) != Chain.UNSPECIFIED
|
||||||
}.mapNotNull { chainDetails ->
|
}.mapNotNull { chainDetails ->
|
||||||
try {
|
try {
|
||||||
val chain = Chain.byId(chainDetails.chain.number)
|
val chain = Chain.byId(chainDetails.chain.number)
|
||||||
|
|||||||
Reference in New Issue
Block a user