NEAR has same pruning algo for state and block (#464)
This commit is contained in:
@@ -8,7 +8,6 @@ import io.emeraldpay.dshackle.upstream.lowerbound.LowerBoundDetector
|
|||||||
import io.emeraldpay.dshackle.upstream.lowerbound.LowerBoundType
|
import io.emeraldpay.dshackle.upstream.lowerbound.LowerBoundType
|
||||||
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
|
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
|
||||||
import reactor.core.publisher.Flux
|
import reactor.core.publisher.Flux
|
||||||
import reactor.kotlin.core.publisher.toFlux
|
|
||||||
|
|
||||||
class NearLowerBoundStateDetector(
|
class NearLowerBoundStateDetector(
|
||||||
private val upstream: Upstream,
|
private val upstream: Upstream,
|
||||||
@@ -21,8 +20,15 @@ class NearLowerBoundStateDetector(
|
|||||||
override fun internalDetectLowerBound(): Flux<LowerBoundData> {
|
override fun internalDetectLowerBound(): Flux<LowerBoundData> {
|
||||||
return upstream.getIngressReader().read(ChainRequest("status", ListParams())).map {
|
return upstream.getIngressReader().read(ChainRequest("status", ListParams())).map {
|
||||||
val resp = Global.objectMapper.readValue(it.getResult(), NearStatus::class.java)
|
val resp = Global.objectMapper.readValue(it.getResult(), NearStatus::class.java)
|
||||||
LowerBoundData(resp.syncInfo.earliestHeight, LowerBoundType.STATE)
|
resp.syncInfo.earliestHeight
|
||||||
}.toFlux()
|
}.flatMapMany {
|
||||||
|
Flux.fromIterable(
|
||||||
|
listOf(
|
||||||
|
LowerBoundData(it, LowerBoundType.STATE),
|
||||||
|
LowerBoundData(it, LowerBoundType.BLOCK),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun types(): Set<LowerBoundType> {
|
override fun types(): Set<LowerBoundType> {
|
||||||
|
|||||||
Reference in New Issue
Block a user