support erigon3 syncing validation (#538)

This commit is contained in:
a10zn8
2024-08-01 13:25:46 +03:00
committed by GitHub
parent 6b249a3e15
commit 09a6508cab

View File

@@ -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
} }
} }
} }