From 117bd2d2946dec8df8bf5c3d0ecd3ba337f424ee Mon Sep 17 00:00:00 2001 From: a10zn8 Date: Sat, 10 Dec 2022 20:39:13 +0400 Subject: [PATCH] Skip unparsed TransactionReceiptJson responses --- .../dshackle/upstream/ethereum/EthereumDirectReader.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumDirectReader.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumDirectReader.kt index 25fbf56e..eb90c74e 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumDirectReader.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumDirectReader.kt @@ -117,7 +117,7 @@ class EthereumDirectReader( val request = JsonRpcRequest("eth_getTransactionReceipt", listOf(key.toHex())) return readWithQuorum(request) .timeout(Defaults.timeoutInternal, Mono.error(TimeoutException("Receipt not read $key"))) - .doOnNext { json -> + .flatMap { json -> try { // Caching needs some additional data (ex. Height) to make a decision on how long and where to cache // So we have to parse the JSON here and extract reference data @@ -134,7 +134,9 @@ class EthereumDirectReader( ) } catch (t: Throwable) { log.warn("Failed to cache Tx Receipt", t) + return@flatMap Mono.empty() } + Mono.just(json) } } }