solution: use quorum for native calls

This commit is contained in:
Igor Artamonov
2019-08-04 18:13:18 -04:00
parent 90d46d15a6
commit 2b7109cea3
29 changed files with 999 additions and 235 deletions

View File

@@ -8,8 +8,9 @@ import java.time.Duration
class ChainUpstreams (
val chain: Chain,
private val upstreams: MutableList<Upstream>
) : AggregatedUpstreams() {
private val upstreams: MutableList<Upstream>,
targets: EthereumTargets
) : AggregatedUpstreams(targets) {
private val log = LoggerFactory.getLogger(ChainUpstreams::class.java)
private var seq = 0
@@ -43,16 +44,16 @@ class ChainUpstreams (
head = updateHead()
}
override fun getApis(quorum: Int, matcher: Selector.Matcher): Iterator<EthereumApi> {
override fun getApis(matcher: Selector.Matcher): Iterator<EthereumApi> {
val i = seq++
if (seq >= Int.MAX_VALUE / 2) {
seq = 0
}
return FilteringApiIterator(upstreams, 1, seq, matcher)
return FilteringApiIterator(upstreams, i, matcher)
}
override fun getApi(matcher: Selector.Matcher): EthereumApi {
return getApis(1, matcher).next()
return getApis(matcher).next()
}
override fun getHead(): EthereumHead {