problem: gives duplicate blocks if came simultaneously from different upstreams
This commit is contained in:
@@ -21,6 +21,9 @@ class EthereumHeadMerge(
|
||||
init {
|
||||
val fluxes = upstreams.map { it.getFlux() }
|
||||
flux = Flux.merge(fluxes)
|
||||
.distinctUntilChanged {
|
||||
it.hash
|
||||
}
|
||||
.filter {
|
||||
val curr = head.get()
|
||||
curr == null || curr.totalDifficulty < it.totalDifficulty
|
||||
|
||||
@@ -37,6 +37,7 @@ class EthereumRpcHead(
|
||||
.onErrorContinue { err, _ ->
|
||||
log.warn("RPC error ${err.message}")
|
||||
}
|
||||
.distinctUntilChanged { it.hash }
|
||||
.filter { block ->
|
||||
val curr = head.get()
|
||||
curr == null || curr.totalDifficulty < block.totalDifficulty
|
||||
|
||||
@@ -75,6 +75,7 @@ open class GrpcUpstream(
|
||||
block.hash = BlockHash.from("0x"+value.blockId)
|
||||
block
|
||||
}
|
||||
.distinctUntilChanged { it.hash }
|
||||
.filter { block ->
|
||||
val curr = headBlock.get()
|
||||
curr == null || curr.totalDifficulty < block.totalDifficulty
|
||||
|
||||
Reference in New Issue
Block a user