Skip to content

Commit 77a14e5

Browse files
authored
fix: block timestamp calculation (#4818)
1 parent 5c5d0d7 commit 77a14e5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/edr_provider/src/data.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ impl<LoggerErrorT: Debug> ProviderData<LoggerErrorT> {
18471847
i64::try_from(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs())
18481848
.expect("timestamp too large");
18491849

1850-
let (mut block_timestamp, new_offset) = if let Some(timestamp) = timestamp {
1850+
let (mut block_timestamp, mut new_offset) = if let Some(timestamp) = timestamp {
18511851
timestamp.checked_sub(latest_block_header.timestamp).ok_or(
18521852
ProviderError::TimestampLowerThanPrevious {
18531853
proposed: timestamp,
@@ -1873,6 +1873,9 @@ impl<LoggerErrorT: Debug> ProviderData<LoggerErrorT> {
18731873
&& !self.allow_blocks_with_same_timestamp;
18741874
if timestamp_needs_increase {
18751875
block_timestamp += 1;
1876+
if new_offset.is_none() {
1877+
new_offset = Some(self.block_time_offset_seconds + 1);
1878+
}
18761879
}
18771880

18781881
Ok((block_timestamp, new_offset))

0 commit comments

Comments
 (0)