problem: miss most of the new blocks
This commit is contained in:
@@ -26,20 +26,20 @@ class EthereumRpcHead(
|
|||||||
val batch = Batch()
|
val batch = Batch()
|
||||||
val f = batch.add(Commands.eth().blockNumber)
|
val f = batch.add(Commands.eth().blockNumber)
|
||||||
api.execute(batch)
|
api.execute(batch)
|
||||||
Mono.fromCompletionStage(f)
|
Mono.fromCompletionStage(f).timeout(Duration.ofSeconds(5))
|
||||||
}
|
}
|
||||||
.flatMap {
|
.flatMap {
|
||||||
val batch = Batch()
|
val batch = Batch()
|
||||||
val f = batch.add(Commands.eth().getBlock(it))
|
val f = batch.add(Commands.eth().getBlock(it))
|
||||||
api.execute(batch)
|
api.execute(batch)
|
||||||
Mono.fromCompletionStage(f)
|
Mono.fromCompletionStage(f).timeout(Duration.ofSeconds(5))
|
||||||
}
|
}
|
||||||
.onErrorContinue { err, _ ->
|
.onErrorContinue { err, _ ->
|
||||||
log.warn("RPC error ${err.message}")
|
log.warn("RPC error ${err.message}")
|
||||||
}
|
}
|
||||||
.filter { block ->
|
.filter { block ->
|
||||||
val curr = head.get()
|
val curr = head.get()
|
||||||
curr == null || curr.difficulty < block.difficulty
|
curr == null || curr.totalDifficulty < block.totalDifficulty
|
||||||
}
|
}
|
||||||
.subscribe { block ->
|
.subscribe { block ->
|
||||||
stream.onNext(block)
|
stream.onNext(block)
|
||||||
|
|||||||
Reference in New Issue
Block a user