Skip to content

Commit 6dc5c31

Browse files
committed
block_stream: Move check to prevent subtraction with overflow
1 parent 17ed2d4 commit 6dc5c31

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chain/ethereum/src/block_stream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,14 @@ where
252252
// Only continue if the subgraph block ptr is behind the head block ptr.
253253
// subgraph_ptr > head_ptr shouldn't happen, but if it does, it's safest to just stop.
254254
if let Some(ptr) = subgraph_ptr {
255-
self.metrics
256-
.blocks_behind
257-
.set((head_ptr.number - ptr.number) as f64);
258-
259255
if ptr.number >= head_ptr.number {
260256
return Box::new(future::ok(ReconciliationStep::Done))
261257
as Box<dyn Future<Item = _, Error = _> + Send>;
262258
}
259+
260+
self.metrics
261+
.blocks_behind
262+
.set((head_ptr.number - ptr.number) as f64);
263263
}
264264

265265
// Subgraph ptr is behind head ptr.

0 commit comments

Comments
 (0)