From 9edb7039914cf2b606bf300f4b7cc8a731fa9367 Mon Sep 17 00:00:00 2001 From: a10zn8 Date: Mon, 19 Sep 2022 04:40:52 +0400 Subject: [PATCH] problem: switches an upstream with disabled validation to the syncing state though it doesn't check the sync for it (cherry picked from commit 55fa1ea0d951c8a6748eb580db5b61a43c36928f) --- .../io/emeraldpay/dshackle/upstream/DefaultUpstream.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DefaultUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DefaultUpstream.kt index 451a53b4..0f967fba 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DefaultUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DefaultUpstream.kt @@ -98,6 +98,11 @@ abstract class DefaultUpstream( } fun statusByLag(lag: Long, proposed: UpstreamAvailability): UpstreamAvailability { + if (options.disableValidation == true) { + // if we specifically told that this upstream should be _always valid_ then skip + // the status calculation and trust the proposed value as is + return proposed + } return if (proposed == UpstreamAvailability.OK) { when { lag > 6 -> UpstreamAvailability.SYNCING