problem: WS connections do not honor disable-validation

This commit is contained in:
Igor Artamonov
2022-05-11 21:04:17 -04:00
committed by GitHub

View File

@@ -20,6 +20,7 @@ import io.emeraldpay.dshackle.reader.Reader
import io.emeraldpay.dshackle.startup.QuorumForLabels import io.emeraldpay.dshackle.startup.QuorumForLabels
import io.emeraldpay.dshackle.upstream.Head import io.emeraldpay.dshackle.upstream.Head
import io.emeraldpay.dshackle.upstream.Upstream import io.emeraldpay.dshackle.upstream.Upstream
import io.emeraldpay.dshackle.upstream.UpstreamAvailability
import io.emeraldpay.dshackle.upstream.calls.CallMethods import io.emeraldpay.dshackle.upstream.calls.CallMethods
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcRequest import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcRequest
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse
@@ -104,9 +105,16 @@ class EthereumWsUpstream(
connection.connect() connection.connect()
head.start() head.start()
log.debug("Start validation for upstream ${this.getId()}") if (getOptions().disableValidation != null && getOptions().disableValidation!!) {
validatorSubscription = validator.start() log.warn("Disable validation for upstream ${this.getId()}")
.subscribe(this::setStatus) this.setLag(0)
this.setStatus(UpstreamAvailability.OK)
} else {
log.debug("Start validation for upstream ${this.getId()}")
val validator = EthereumUpstreamValidator(this, getOptions())
validatorSubscription = validator.start()
.subscribe(this::setStatus)
}
} }
override fun stop() { override fun stop() {