Skip to content

Commit 3430a81

Browse files
committed
fix: advance cursor before depth check
1 parent 69eb7ac commit 3430a81

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

stackslib/src/net/api/get_tenures_fork_info.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ impl RPCRequestHandler for GetTenuresForkInfo {
237237
if height_bound >= cursor.block_height {
238238
return Err(ChainError::NotInSameFork);
239239
}
240-
240+
cursor =
241+
SortitionDB::get_block_snapshot(sortdb.conn(), &cursor.parent_sortition_id)?
242+
.ok_or_else(|| ChainError::NoSuchBlockError)?;
241243
if cursor.sortition
242244
|| chainstate
243245
.nakamoto_blocks_db()
@@ -250,10 +252,6 @@ impl RPCRequestHandler for GetTenuresForkInfo {
250252
&network.stacks_tip.block_id(),
251253
)?);
252254
}
253-
254-
cursor =
255-
SortitionDB::get_block_snapshot(sortdb.conn(), &cursor.parent_sortition_id)?
256-
.ok_or_else(|| ChainError::NoSuchBlockError)?;
257255
}
258256

259257
Ok(results)

0 commit comments

Comments
 (0)