From 51751741b3f295f06d95c6bdb213ba0bc37e26e6 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Mon, 10 Jun 2019 21:51:03 -0400 Subject: [PATCH] problem: miss most of the new blocks --- .../io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt index e6a83ebc..528824ac 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/EthereumRpcHead.kt @@ -26,20 +26,20 @@ class EthereumRpcHead( val batch = Batch() val f = batch.add(Commands.eth().blockNumber) api.execute(batch) - Mono.fromCompletionStage(f) + Mono.fromCompletionStage(f).timeout(Duration.ofSeconds(5)) } .flatMap { val batch = Batch() val f = batch.add(Commands.eth().getBlock(it)) api.execute(batch) - Mono.fromCompletionStage(f) + Mono.fromCompletionStage(f).timeout(Duration.ofSeconds(5)) } .onErrorContinue { err, _ -> log.warn("RPC error ${err.message}") } .filter { block -> val curr = head.get() - curr == null || curr.difficulty < block.difficulty + curr == null || curr.totalDifficulty < block.totalDifficulty } .subscribe { block -> stream.onNext(block)