Skip to content

Commit c247a47

Browse files
committed
chore: address PR feedback
1 parent bdd0cc1 commit c247a47

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,25 +2877,6 @@ impl SortitionDB {
28772877
query_rows(self.conn(), qry, NO_PARAMS)
28782878
}
28792879

2880-
/// Load up all stacks chain tips, in ascending order by block height. Great for testing!
2881-
pub fn get_all_stacks_chain_tips(
2882-
&self,
2883-
) -> Result<Vec<(SortitionId, ConsensusHash, BlockHeaderHash, u64)>, db_error> {
2884-
let sql = "SELECT * FROM stacks_chain_tips ORDER BY block_height ASC";
2885-
let mut stmt = self.conn().prepare(sql)?;
2886-
let mut qry = stmt.query(NO_PARAMS)?;
2887-
let mut ret = vec![];
2888-
while let Some(row) = qry.next()? {
2889-
let sort_id: SortitionId = row.get("sortition_id")?;
2890-
let consensus_hash: ConsensusHash = row.get("consensus_hash")?;
2891-
let block_hash: BlockHeaderHash = row.get("block_hash")?;
2892-
let block_height_i64: i64 = row.get("block_height")?;
2893-
let block_height = u64::try_from(block_height_i64).map_err(|_| db_error::ParseError)?;
2894-
ret.push((sort_id, consensus_hash, block_hash, block_height));
2895-
}
2896-
Ok(ret)
2897-
}
2898-
28992880
/// Get all snapshots for a burn block hash, even if they're not on the canonical PoX fork.
29002881
pub fn get_all_snapshots_for_burn_block(
29012882
conn: &DBConn,
@@ -6633,6 +6614,26 @@ pub mod tests {
66336614

66346615
Ok(None)
66356616
}
6617+
6618+
/// Load up all stacks chain tips, in ascending order by block height. Great for testing!
6619+
pub fn get_all_stacks_chain_tips(
6620+
&self,
6621+
) -> Result<Vec<(SortitionId, ConsensusHash, BlockHeaderHash, u64)>, db_error> {
6622+
let sql = "SELECT * FROM stacks_chain_tips ORDER BY block_height ASC";
6623+
let mut stmt = self.conn().prepare(sql)?;
6624+
let mut qry = stmt.query(NO_PARAMS)?;
6625+
let mut ret = vec![];
6626+
while let Some(row) = qry.next()? {
6627+
let sort_id: SortitionId = row.get("sortition_id")?;
6628+
let consensus_hash: ConsensusHash = row.get("consensus_hash")?;
6629+
let block_hash: BlockHeaderHash = row.get("block_hash")?;
6630+
let block_height_i64: i64 = row.get("block_height")?;
6631+
let block_height =
6632+
u64::try_from(block_height_i64).map_err(|_| db_error::ParseError)?;
6633+
ret.push((sort_id, consensus_hash, block_hash, block_height));
6634+
}
6635+
Ok(ret)
6636+
}
66366637
}
66376638

66386639
#[test]

0 commit comments

Comments
 (0)