Merge pull request #78 from p2p-org/do-not-process-unparsed-receipt-json

Skip unparsed TransactionReceiptJson responses
This commit is contained in:
a10zn8
2022-12-10 20:47:27 +04:00
committed by GitHub

View File

@@ -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)
}
}
}