support erigon3 syncing validation (#538)
This commit is contained in:
@@ -115,25 +115,20 @@ object EthereumChainSpecific : AbstractPollChainSpecific() {
|
|||||||
} else {
|
} else {
|
||||||
UpstreamAvailability.OK
|
UpstreamAvailability.OK
|
||||||
}
|
}
|
||||||
} else {
|
} else if (raw.get("currentBlock") != null && raw.get("highestBlock") != null) {
|
||||||
when (chain) {
|
val current =
|
||||||
Chain.TRON__MAINNET, Chain.TRON__SHASTA -> {
|
BigInteger(raw.get("currentBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
|
||||||
var current =
|
val highest =
|
||||||
BigInteger(raw.get("currentBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
|
BigInteger(raw.get("highestBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
|
||||||
var highest =
|
|
||||||
BigInteger(raw.get("highestBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
|
|
||||||
|
|
||||||
if (highest - current > config.syncingLagSize.toBigInteger()) {
|
if (highest - current > config.syncingLagSize.toBigInteger()) {
|
||||||
UpstreamAvailability.SYNCING
|
UpstreamAvailability.SYNCING
|
||||||
} else {
|
} else {
|
||||||
UpstreamAvailability.OK
|
UpstreamAvailability.OK
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
log.warn("Received syncing object ${raw.toPrettyString()} for upstream ${upstream.getId()}")
|
|
||||||
UpstreamAvailability.SYNCING
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.error("Received unknown syncing object ${raw.toPrettyString()} for upstream ${upstream.getId()}")
|
||||||
|
UpstreamAvailability.OK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user