Skip to content

Commit 26b66fd

Browse files
committed
f - Change height checks to debug assertions
1 parent a4ab8f4 commit 26b66fd

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
@@ -279,14 +279,15 @@ impl<C: Cache> ChainNotifier<C> {
279279
let mut previous = *prev_header;
280280
loop {
281281
// Found the parent block.
282-
if current.height == previous.height + 1 &&
283-
current.header.prev_blockhash == previous.block_hash {
282+
if current.header.prev_blockhash == previous.block_hash {
283+
debug_assert_eq!(current.height, previous.height + 1);
284284
steps.push(ForkStep::ConnectBlock(current));
285285
break;
286286
}
287287

288288
// Found a chain fork.
289289
if current.header.prev_blockhash == previous.header.prev_blockhash {
290+
debug_assert_eq!(current.height, previous.height);
290291
let fork_point = self.look_up_previous_header(chain_poller, &previous).await?;
291292
steps.push(ForkStep::DisconnectBlock(previous));
292293
steps.push(ForkStep::ConnectBlock(current));

0 commit comments

Comments
 (0)