diff --git a/emerald-grpc b/emerald-grpc index 474627a53..0fff78d64 160000 --- a/emerald-grpc +++ b/emerald-grpc @@ -1 +1 @@ -Subproject commit 474627a53bde6576d56276687ff3b1c1c5fca96a +Subproject commit 0fff78d64b5642f934edaec13d2ae0be29560b36 diff --git a/src/main/kotlin/io/emeraldpay/dshackle/rpc/StreamHead.kt b/src/main/kotlin/io/emeraldpay/dshackle/rpc/StreamHead.kt index d13787e0d..792bbb2cb 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/rpc/StreamHead.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/rpc/StreamHead.kt @@ -57,6 +57,7 @@ class StreamHead( .setSlot(block.slot) .setCurrentLowerBlock(ms.getLowerBlock().blockNumber) .setCurrentLowerSlot(ms.getLowerBlock().slot ?: 0) + .setCurrentLowerDataTimestamp(ms.getLowerBlock().timestamp) .setTimestamp(block.timestamp.toEpochMilli()) .setWeight(ByteString.copyFrom(block.difficulty.toByteArray())) .setBlockId(block.hash.toHex()) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/LowerBoundBlockDetector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/LowerBoundBlockDetector.kt index 4160d929b..2a3ea89a0 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/LowerBoundBlockDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/LowerBoundBlockDetector.kt @@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory import reactor.core.publisher.Flux import reactor.core.publisher.Mono import java.time.Duration +import java.time.Instant import java.util.concurrent.atomic.AtomicReference typealias LowerBoundBlockDetectorBuilder = (Chain, Upstream) -> LowerBoundBlockDetector @@ -41,11 +42,14 @@ abstract class LowerBoundBlockDetector( data class LowerBlockData( val blockNumber: Long, val slot: Long?, + val timestamp: Long, ) : Comparable { - constructor(blockNumber: Long) : this(blockNumber, null) + constructor(blockNumber: Long) : this(blockNumber, null, Instant.now().epochSecond) + + constructor(blockNumber: Long, slot: Long) : this(blockNumber, slot, Instant.now().epochSecond) companion object { - fun default() = LowerBlockData(0, 0) + fun default() = LowerBlockData(0, 0, 0) } override fun compareTo(other: LowerBlockData): Int { 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 1622dfc22..da8ab10f2 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundBlockDetector.kt @@ -33,6 +33,7 @@ class EthereumLowerBoundBlockDetector( "header for hash not found", "after last accepted block", "Version has either been pruned, or is for a future block", // cronos + "no historical RPC is available for this historical", // optimism ) }