Merge pull request #10 from p2p-org/fix_divide_by_zero_error

log failed validation
This commit is contained in:
MaxFomenkov
2022-09-05 17:51:26 +03:00
committed by GitHub

View File

@@ -57,7 +57,12 @@ abstract class AbstractHead(
}
.subscribeOn(Schedulers.boundedElastic())
.subscribe { block ->
if (blockValidator.isValid(forkChoice.getHead(), block)) {
val valid = runCatching {
blockValidator.isValid(forkChoice.getHead(), block)
}.onFailure {
log.error("Block ${block.hash} validation failed with '${it.message}'", it)
}.getOrElse { false }
if (valid) {
notifyBeforeBlock()
when (val choiceResult = forkChoice.choose(block)) {
is ForkChoice.ChoiceResult.Updated -> {