Support for widers scope of providers

- we need to read full block in case transactions is empty OR totalDifficulty is null
- we need to log errors in upstream validation process
This commit is contained in:
a10zn8
2023-02-14 22:37:35 +04:00
parent cbb436f3f0
commit 268537f727
2 changed files with 8 additions and 2 deletions

View File

@@ -81,6 +81,9 @@ open class EthereumUpstreamValidator(
}
}
}
.doOnError {
log.warn("Error validating ${upstream.getId()}", it)
}
.onErrorReturn(UpstreamAvailability.UNAVAILABLE)
}

View File

@@ -71,8 +71,11 @@ class EthereumWsHead(
.flatMap { block ->
// newHeads returns incomplete blocks, i.e. without some fields and without transaction hashes,
// so we need to fetch the full block data
if (block.difficulty == null || block.transactions == null) {
// TODO do we really need this ?
if (block.difficulty == null ||
block.transactions == null ||
block.transactions.isEmpty() ||
block.totalDifficulty == null
) {
enhanceRealBlock(block)
} else {
Mono.just(BlockContainer.from(block))