Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support erigon3 syncing validation #538

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,20 @@ object EthereumChainSpecific : AbstractPollChainSpecific() {
} else {
UpstreamAvailability.OK
}
} else {
when (chain) {
Chain.TRON__MAINNET, Chain.TRON__SHASTA -> {
var current =
BigInteger(raw.get("currentBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
var highest =
BigInteger(raw.get("highestBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)

if (highest - current > config.syncingLagSize.toBigInteger()) {
UpstreamAvailability.SYNCING
} else {
UpstreamAvailability.OK
}
}
else -> {
log.warn("Received syncing object ${raw.toPrettyString()} for upstream ${upstream.getId()}")
UpstreamAvailability.SYNCING
}
} else if (raw.get("currentBlock") != null && raw.get("highestBlock") != null) {
val current =
BigInteger(raw.get("currentBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)
msizov marked this conversation as resolved.
Show resolved Hide resolved
val highest =
BigInteger(raw.get("highestBlock")?.asText()?.lowercase()?.substringAfter("x"), 16)

if (highest - current > config.syncingLagSize.toBigInteger()) {
UpstreamAvailability.SYNCING
} else {
UpstreamAvailability.OK
}
} else {
log.error("Received unknown syncing object ${raw.toPrettyString()} for upstream ${upstream.getId()}")
UpstreamAvailability.OK
msizov marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Loading