From 46bb122f1b48ac3e084eb07ec9444074808d84e7 Mon Sep 17 00:00:00 2001 From: KirillPamPam Date: Thu, 1 Feb 2024 18:01:15 +0400 Subject: [PATCH] Fix state for 0x0 block (#412) --- .../dshackle/upstream/RecursiveLowerBoundBlockDetector.kt | 2 +- .../upstream/ethereum/EthereumLowerBoundBlockDetector.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/RecursiveLowerBoundBlockDetector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/RecursiveLowerBoundBlockDetector.kt index e17fb00d8..fa3190516 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/RecursiveLowerBoundBlockDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/RecursiveLowerBoundBlockDetector.kt @@ -27,7 +27,7 @@ abstract class RecursiveLowerBoundBlockDetector( } else { val middle = middleBlock(data) - if (data.left > data.right || middle == 0L) { + if (data.left > data.right) { val current = if (data.current == 0L) 1 else data.current Mono.just(LowerBoundData(current, true)) } else { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt index 53f8c7498..feb82009a 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt @@ -40,6 +40,9 @@ class EthereumLowerBoundBlockDetector( } override fun hasState(blockNumber: Long): Mono { + if (blockNumber == 0L) { + return Mono.just(true) + } return upstream.getIngressReader().read( JsonRpcRequest( "eth_getBalance",