Skip to content

Commit 12c02f7

Browse files
committed
f - Change height checks to debug assertions
1 parent f4fa1ef commit 12c02f7

File tree

1 file changed

+3
-2
lines changed
  • lightning-block-sync/src

1 file changed

+3
-2
lines changed

lightning-block-sync/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,15 @@ impl<C: Cache> ChainNotifier<C> {
283283
let mut previous = *prev_header;
284284
loop {
285285
// Found the parent block.
286-
if current.height == previous.height + 1 &&
287-
current.header.prev_blockhash == previous.block_hash {
286+
if current.header.prev_blockhash == previous.block_hash {
287+
debug_assert_eq!(current.height, previous.height + 1);
288288
steps.push(ForkStep::ConnectBlock(current));
289289
break;
290290
}
291291

292292
// Found a chain fork.
293293
if current.header.prev_blockhash == previous.header.prev_blockhash {
294+
debug_assert_eq!(current.height, previous.height);
294295
let fork_point = self.look_up_previous_header(chain_poller, &previous).await?;
295296
steps.push(ForkStep::DisconnectBlock(previous));
296297
steps.push(ForkStep::ConnectBlock(current));

0 commit comments

Comments
 (0)