diff --git a/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfig.kt b/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfig.kt index f8cf5dd7..a3f88519 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfig.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfig.kt @@ -116,8 +116,8 @@ open class UpstreamsConfig { } class EthereumPosConnection : UpstreamConnection() { - var execution : EthereumConnection? = null - var blockPriority : Int = 0 + var execution: EthereumConnection? = null + var blockPriority: Int = 0 } data class BitcoinZeroMq( diff --git a/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfigReader.kt b/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfigReader.kt index 9ab5be40..71dd6704 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfigReader.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/config/UpstreamsConfigReader.kt @@ -165,7 +165,7 @@ class UpstreamsConfigReader( return connection } - private fun readEthereumPosConnection(connConfigNode: MappingNode) : UpstreamsConfig.EthereumPosConnection { + private fun readEthereumPosConnection(connConfigNode: MappingNode): UpstreamsConfig.EthereumPosConnection { val connection = UpstreamsConfig.EthereumPosConnection() getMapping(connConfigNode, "execution")?.let { connection.execution = readEthereumConnection(it) @@ -175,7 +175,7 @@ class UpstreamsConfigReader( } return connection } - private fun readEthereumConnection(connConfigNode : MappingNode) : UpstreamsConfig.EthereumConnection { + private fun readEthereumConnection(connConfigNode: MappingNode): UpstreamsConfig.EthereumConnection { val connection = UpstreamsConfig.EthereumConnection() getMapping(connConfigNode, "rpc")?.let { node -> getValueAsString(node, "url")?.let { url -> @@ -211,7 +211,7 @@ class UpstreamsConfigReader( return connection } - private fun readUpstream(config: UpstreamsConfig, upNode: MappingNode, connFactory: () -> T) { + private fun readUpstream(config: UpstreamsConfig, upNode: MappingNode, connFactory: () -> T) { val upstream = UpstreamsConfig.Upstream() readUpstreamCommon(upNode, upstream) readUpstreamStandard(upNode, upstream) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/data/RingSet.kt b/src/main/kotlin/io/emeraldpay/dshackle/data/RingSet.kt index a3e1815e..37b37af4 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/data/RingSet.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/data/RingSet.kt @@ -4,7 +4,7 @@ import java.util.concurrent.atomic.AtomicReference class RingSet( private val maxSize: Int -): Set { +) : Set { private var seqValues: AtomicReference> = AtomicReference(emptyList()) private var set: Set = emptySet() override val size: Int @@ -41,4 +41,4 @@ class RingSet( override fun containsAll(elements: Collection<@UnsafeVariance T>): Boolean { return set.containsAll(elements) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeSubscribe.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeSubscribe.kt index 6827735e..a2b7b3b2 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeSubscribe.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/NativeSubscribe.kt @@ -21,7 +21,6 @@ import io.emeraldpay.dshackle.Global import io.emeraldpay.dshackle.SilentException import io.emeraldpay.dshackle.upstream.MultistreamHolder import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import io.emeraldpay.grpc.BlockchainType import io.emeraldpay.grpc.Chain import io.grpc.Status diff --git a/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt index 0eba3a3b..994c42d1 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/startup/ConfiguredUpstreams.kt @@ -20,7 +20,11 @@ import io.emeraldpay.dshackle.FileResolver import io.emeraldpay.dshackle.Global import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.reader.Reader -import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.CurrentMultistreamHolder +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.HttpRpcFactory +import io.emeraldpay.dshackle.upstream.MergedHead +import io.emeraldpay.dshackle.upstream.Upstream import io.emeraldpay.dshackle.upstream.bitcoin.BitcoinRpcHead import io.emeraldpay.dshackle.upstream.bitcoin.BitcoinRpcUpstream import io.emeraldpay.dshackle.upstream.bitcoin.BitcoinZMQHead @@ -147,7 +151,7 @@ open class ConfiguredUpstreams( config: UpstreamsConfig.Upstream, chain: Chain, options: UpstreamsConfig.Options - ) : Upstream? { + ): Upstream? { val conn = config.connection!! val execution = conn.execution if (execution == null) { @@ -176,7 +180,7 @@ open class ConfiguredUpstreams( config: UpstreamsConfig.Upstream, chain: Chain, options: UpstreamsConfig.Options - ) : Upstream? { + ): Upstream? { val conn = config.connection!! val httpFactory = buildHttpFactory(conn) if (httpFactory == null) { @@ -218,7 +222,7 @@ open class ConfiguredUpstreams( config: UpstreamsConfig.Upstream, chain: Chain, options: UpstreamsConfig.Options - ) : EthereumRpcUpstream? { + ): EthereumRpcUpstream? { val conn = config.connection!! val urls = ArrayList() @@ -291,7 +295,7 @@ open class ConfiguredUpstreams( } } - private fun buildEthereumConnectorFactory(conn: UpstreamsConfig.EthereumConnection, chain: Chain, urls: ArrayList, forkChoice: ForkChoice): EthereumConnectorFactory? { + private fun buildEthereumConnectorFactory(conn: UpstreamsConfig.EthereumConnection, chain: Chain, urls: ArrayList, forkChoice: ForkChoice): EthereumConnectorFactory? { val wsFactoryApi = buildWsFactory(conn, urls) val httpFactory = buildHttpFactory(conn, urls) log.info("Using ${chain.chainName} upstream, at ${urls.joinToString()}") diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AbstractHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/AbstractHead.kt index ce4e7931..48ebfe63 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/AbstractHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/AbstractHead.kt @@ -20,11 +20,9 @@ import io.emeraldpay.dshackle.upstream.forkchoice.ForkChoice import org.slf4j.LoggerFactory import reactor.core.Disposable import reactor.core.publisher.Flux -import reactor.core.publisher.Mono import reactor.core.publisher.Sinks import reactor.core.scheduler.Schedulers import reactor.kotlin.core.publisher.toMono -import java.util.concurrent.atomic.AtomicReference abstract class AbstractHead( private val forkChoice: ForkChoice diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DistanceExtractor.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DistanceExtractor.kt index 77dc9b61..677d1e7f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/DistanceExtractor.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/DistanceExtractor.kt @@ -4,8 +4,8 @@ import io.emeraldpay.dshackle.data.BlockContainer class DistanceExtractor { sealed class ChainDistance { - data class Distance(val dist: Long): ChainDistance() - object Fork: ChainDistance() + data class Distance(val dist: Long) : ChainDistance() + object Fork : ChainDistance() } companion object { @@ -25,4 +25,4 @@ class DistanceExtractor { } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpFactory.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpFactory.kt index 10d99560..359476ed 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpFactory.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpFactory.kt @@ -7,4 +7,4 @@ import io.emeraldpay.grpc.Chain interface HttpFactory { fun create(id: String?, chain: Chain): Reader -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpRpcFactory.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpRpcFactory.kt index 9261cc6c..adf0aafd 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpRpcFactory.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/HttpRpcFactory.kt @@ -42,4 +42,4 @@ open class HttpRpcFactory( tls ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/bitcoin/BitcoinMultistream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/bitcoin/BitcoinMultistream.kt index 8a9054b7..3d8b0bba 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/bitcoin/BitcoinMultistream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/bitcoin/BitcoinMultistream.kt @@ -86,8 +86,8 @@ open class BitcoinMultistream( } } else { val newHead = MergedHead(upstreams.map { it.getHead() }, MostWorkForkChoice()).apply { - this.start() - } + this.start() + } val lagObserver = BitcoinHeadLagObserver(newHead, upstreams) this.lagObserver = lagObserver lagObserver.start() diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcUpstream.kt index e4b104cd..b071af41 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumRpcUpstream.kt @@ -21,7 +21,9 @@ import io.emeraldpay.dshackle.cache.CachesEnabled import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.reader.Reader import io.emeraldpay.dshackle.startup.QuorumForLabels -import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.upstream.UpstreamAvailability import io.emeraldpay.dshackle.upstream.calls.CallMethods import io.emeraldpay.dshackle.upstream.ethereum.connectors.ConnectorFactory import io.emeraldpay.dshackle.upstream.ethereum.connectors.EthereumConnector @@ -42,8 +44,8 @@ open class EthereumRpcUpstream( connectorFactory: ConnectorFactory ) : EthereumUpstream(id, options, role, targets, node), Lifecycle, Upstream, CachesEnabled { private val log = LoggerFactory.getLogger(EthereumRpcUpstream::class.java) - private val validator : EthereumUpstreamValidator = EthereumUpstreamValidator(this, getOptions()) - private val connector : EthereumConnector = connectorFactory.create(this, validator, chain) + private val validator: EthereumUpstreamValidator = EthereumUpstreamValidator(this, getOptions()) + private val connector: EthereumConnector = connectorFactory.create(this, validator, chain) private var validatorSubscription: Disposable? = null diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt index 0b50610e..c14bd120 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstream.kt @@ -43,4 +43,4 @@ abstract class EthereumUpstream( override fun getLabels(): Collection { return node?.let { listOf(it.labels) } ?: emptyList() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt index d8cbc7bd..d1fdc07c 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt @@ -22,7 +22,6 @@ import io.emeraldpay.dshackle.Global import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.upstream.Upstream import io.emeraldpay.dshackle.upstream.UpstreamAvailability -import io.emeraldpay.dshackle.upstream.ethereum.connectors.EthereumConnector import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcRequest import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse import io.emeraldpay.etherjar.rpc.json.SyncingJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/ConnectorFactory.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/ConnectorFactory.kt index 09c5f26d..0e0d21e5 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/ConnectorFactory.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/ConnectorFactory.kt @@ -7,4 +7,4 @@ import io.emeraldpay.grpc.Chain interface ConnectorFactory { fun create(upstream: DefaultUpstream, validator: EthereumUpstreamValidator, chain: Chain): EthereumConnector fun isValid(): Boolean -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnector.kt index dcd8f5b0..85ecf596 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnector.kt @@ -10,4 +10,4 @@ interface EthereumConnector : Lifecycle { fun getHead(): Head fun getApi(): Reader -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnectorFactory.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnectorFactory.kt index 78f69556..2850ee10 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnectorFactory.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumConnectorFactory.kt @@ -2,7 +2,6 @@ package io.emeraldpay.dshackle.upstream.ethereum.connectors import io.emeraldpay.dshackle.upstream.DefaultUpstream import io.emeraldpay.dshackle.upstream.HttpFactory -import io.emeraldpay.dshackle.upstream.HttpRpcFactory import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstreamValidator import io.emeraldpay.dshackle.upstream.ethereum.EthereumWsFactory import io.emeraldpay.dshackle.upstream.forkchoice.ForkChoice @@ -14,18 +13,18 @@ open class EthereumConnectorFactory( private val wsFactory: EthereumWsFactory?, private val httpFactory: HttpFactory?, private val forkChoice: ForkChoice -): ConnectorFactory { +) : ConnectorFactory { private val log = LoggerFactory.getLogger(EthereumConnectorFactory::class.java) override fun isValid(): Boolean { if (preferHttp && httpFactory == null) { - return false; + return false } return true } override fun create(upstream: DefaultUpstream, validator: EthereumUpstreamValidator, chain: Chain): EthereumConnector { - if (wsFactory!= null && !preferHttp) { + if (wsFactory != null && !preferHttp) { return EthereumWsConnector(wsFactory, upstream, validator, chain, forkChoice) } if (httpFactory == null) { @@ -33,4 +32,4 @@ open class EthereumConnectorFactory( } return EthereumRpcConnector(httpFactory.create(upstream.getId(), chain), wsFactory, upstream.getId(), forkChoice) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumRpcConnector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumRpcConnector.kt index 8ca9d135..03c541b1 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumRpcConnector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumRpcConnector.kt @@ -5,9 +5,11 @@ import io.emeraldpay.dshackle.cache.CachesEnabled import io.emeraldpay.dshackle.reader.Reader import io.emeraldpay.dshackle.upstream.Head import io.emeraldpay.dshackle.upstream.MergedHead -import io.emeraldpay.dshackle.upstream.ethereum.* +import io.emeraldpay.dshackle.upstream.ethereum.EthereumRpcHead +import io.emeraldpay.dshackle.upstream.ethereum.EthereumWsFactory +import io.emeraldpay.dshackle.upstream.ethereum.EthereumWsHead +import io.emeraldpay.dshackle.upstream.ethereum.WsConnection import io.emeraldpay.dshackle.upstream.forkchoice.ForkChoice -import io.emeraldpay.dshackle.upstream.forkchoice.MostWorkForkChoice import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcRequest import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse import org.slf4j.LoggerFactory @@ -15,13 +17,13 @@ import org.springframework.context.Lifecycle import java.time.Duration class EthereumRpcConnector( - private val directReader : Reader, + private val directReader: Reader, wsFactory: EthereumWsFactory?, - id : String, + id: String, forkChoice: ForkChoice ) : EthereumConnector, CachesEnabled { - private val conn : WsConnection? - private val head : Head + private val conn: WsConnection? + private val head: Head companion object { private val log = LoggerFactory.getLogger(EthereumRpcConnector::class.java) @@ -76,4 +78,4 @@ class EthereumRpcConnector( override fun getHead(): Head { return head } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumWsConnector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumWsConnector.kt index 46bd437b..c4844dda 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumWsConnector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/connectors/EthereumWsConnector.kt @@ -58,7 +58,7 @@ class EthereumWsConnector( } override fun isRunning(): Boolean { - return head.isRunning + return head.isRunning } override fun stop() { @@ -73,4 +73,4 @@ class EthereumWsConnector( override fun getHead(): Head { return head } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectBlockUpdates.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectBlockUpdates.kt index 252276a7..0a424faf 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectBlockUpdates.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectBlockUpdates.kt @@ -20,7 +20,6 @@ import io.emeraldpay.dshackle.data.BlockId import io.emeraldpay.dshackle.data.TxId import io.emeraldpay.dshackle.upstream.Head import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import org.slf4j.LoggerFactory import reactor.core.publisher.Flux import reactor.core.scheduler.Schedulers diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectLogs.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectLogs.kt index ce99e941..9482a10f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectLogs.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectLogs.kt @@ -16,7 +16,6 @@ package io.emeraldpay.dshackle.upstream.ethereum.subscribe import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import io.emeraldpay.dshackle.upstream.ethereum.subscribe.json.LogMessage import io.emeraldpay.etherjar.domain.Address import io.emeraldpay.etherjar.hex.Hex32 diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectNewHeads.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectNewHeads.kt index f5d1b052..c3b7bb4a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectNewHeads.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectNewHeads.kt @@ -16,7 +16,6 @@ package io.emeraldpay.dshackle.upstream.ethereum.subscribe import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import io.emeraldpay.dshackle.upstream.ethereum.subscribe.json.NewHeadMessage import org.slf4j.LoggerFactory import reactor.core.publisher.Flux diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectSyncing.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectSyncing.kt index fc0d7285..d65af1e7 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectSyncing.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ConnectSyncing.kt @@ -17,7 +17,6 @@ package io.emeraldpay.dshackle.upstream.ethereum.subscribe import io.emeraldpay.dshackle.upstream.UpstreamAvailability import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import org.slf4j.LoggerFactory import reactor.core.publisher.Flux import java.time.Duration diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ProduceLogs.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ProduceLogs.kt index 374193e0..44da804d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ProduceLogs.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/subscribe/ProduceLogs.kt @@ -21,7 +21,6 @@ import io.emeraldpay.dshackle.data.BlockId import io.emeraldpay.dshackle.data.TxId import io.emeraldpay.dshackle.reader.Reader import io.emeraldpay.dshackle.upstream.ethereum.EthereumLikeMultistream -import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream import io.emeraldpay.dshackle.upstream.ethereum.subscribe.json.LogMessage import io.emeraldpay.etherjar.hex.HexData import io.emeraldpay.etherjar.rpc.json.TransactionReceiptJson diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosRpcUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosRpcUpstream.kt index 7838c08e..7cd6cca6 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosRpcUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosRpcUpstream.kt @@ -21,7 +21,9 @@ import io.emeraldpay.dshackle.cache.CachesEnabled import io.emeraldpay.dshackle.config.UpstreamsConfig import io.emeraldpay.dshackle.reader.Reader import io.emeraldpay.dshackle.startup.QuorumForLabels -import io.emeraldpay.dshackle.upstream.* +import io.emeraldpay.dshackle.upstream.Head +import io.emeraldpay.dshackle.upstream.Upstream +import io.emeraldpay.dshackle.upstream.UpstreamAvailability import io.emeraldpay.dshackle.upstream.calls.CallMethods import io.emeraldpay.dshackle.upstream.ethereum.connectors.ConnectorFactory import io.emeraldpay.dshackle.upstream.ethereum.connectors.EthereumConnector @@ -42,8 +44,8 @@ open class EthereumPosRpcUpstream( connectorFactory: ConnectorFactory ) : EthereumPosUpstream(id, options, role, targets, node), Lifecycle, Upstream, CachesEnabled { private val log = LoggerFactory.getLogger(EthereumPosRpcUpstream::class.java) - private val validator : EthereumUpstreamValidator = EthereumUpstreamValidator(this, getOptions()) - private val connector : EthereumConnector = connectorFactory.create(this, validator, chain) + private val validator: EthereumUpstreamValidator = EthereumUpstreamValidator(this, getOptions()) + private val connector: EthereumConnector = connectorFactory.create(this, validator, chain) private var validatorSubscription: Disposable? = null diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosUpstream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosUpstream.kt index f98aa936..4ce8253a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosUpstream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum_pos/EthereumPosUpstream.kt @@ -43,4 +43,4 @@ abstract class EthereumPosUpstream( override fun getLabels(): Collection { return node?.let { listOf(it.labels) } ?: emptyList() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/ForkChoice.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/ForkChoice.kt index aa664241..2db6006a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/ForkChoice.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/ForkChoice.kt @@ -5,8 +5,8 @@ import io.emeraldpay.dshackle.data.BlockContainer interface ForkChoice { sealed class ChoiceResult { - data class Updated(val nwhead: BlockContainer): ChoiceResult() - data class Same(val head: BlockContainer?): ChoiceResult() + data class Updated(val nwhead: BlockContainer) : ChoiceResult() + data class Same(val head: BlockContainer?) : ChoiceResult() } fun getHead(): BlockContainer? @@ -14,4 +14,4 @@ interface ForkChoice { fun filter(block: BlockContainer): Boolean fun choose(block: BlockContainer): ChoiceResult -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/MostWorkForkChoice.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/MostWorkForkChoice.kt index d4c5e9c0..cc276b45 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/MostWorkForkChoice.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/MostWorkForkChoice.kt @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicReference class MostWorkForkChoice : ForkChoice { private val head = AtomicReference(null) - override fun getHead() : BlockContainer? { + override fun getHead(): BlockContainer? { return head.get() } @@ -28,5 +28,4 @@ class MostWorkForkChoice : ForkChoice { } return ForkChoice.ChoiceResult.Same(nwhead) } - -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/NoChoiceWithPriorityForkChoice.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/NoChoiceWithPriorityForkChoice.kt index 523f4547..177ae220 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/NoChoiceWithPriorityForkChoice.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/NoChoiceWithPriorityForkChoice.kt @@ -7,7 +7,7 @@ import java.util.concurrent.atomic.AtomicReference class NoChoiceWithPriorityForkChoice( private val nodeRating: Int -): ForkChoice { +) : ForkChoice { private val head = AtomicReference(null) private val seenBlocks = RingSet(10) @@ -33,4 +33,4 @@ class NoChoiceWithPriorityForkChoice( } return ForkChoice.ChoiceResult.Same(nwhead) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/PriorityForkChoice.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/PriorityForkChoice.kt index e9ec338b..50685b3a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/PriorityForkChoice.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/forkchoice/PriorityForkChoice.kt @@ -5,7 +5,7 @@ import io.emeraldpay.dshackle.data.BlockId import io.emeraldpay.dshackle.data.RingSet import java.util.concurrent.atomic.AtomicReference -class PriorityForkChoice: ForkChoice { +class PriorityForkChoice : ForkChoice { private val head = AtomicReference(null) private val seenBlocks = RingSet(10) @@ -32,4 +32,4 @@ class PriorityForkChoice: ForkChoice { } return ForkChoice.ChoiceResult.Same(nwhead) } -} \ No newline at end of file +}