Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feat/expose-node-is-synced
Browse files Browse the repository at this point in the history
  • Loading branch information
ASuciuX authored Jun 25, 2024
2 parents bf0672f + c6dc1c2 commit ebb6aac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stackslib/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,11 +899,11 @@ simulating a miner.

let query = match mode {
Some("prefix") => format!(
"SELECT index_block_hash FROM staging_blocks WHERE index_block_hash LIKE \"{}%\"",
"SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0 AND index_block_hash LIKE \"{}%\"",
argv[4]
),
Some("first") => format!(
"SELECT index_block_hash FROM staging_blocks ORDER BY height ASC LIMIT {}",
"SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0 ORDER BY height ASC LIMIT {}",
argv[4]
),
Some("range") => {
Expand All @@ -913,23 +913,23 @@ simulating a miner.
let arg5 = argv[5].parse::<u64>().expect("<end_block> not a valid u64");
let start = arg4.saturating_sub(1);
let blocks = arg5.saturating_sub(arg4);
format!("SELECT index_block_hash FROM staging_blocks ORDER BY height ASC LIMIT {start}, {blocks}")
format!("SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0 ORDER BY height ASC LIMIT {start}, {blocks}")
}
Some("index-range") => {
let start = argv[4]
.parse::<u64>()
.expect("<start_block> not a valid u64");
let end = argv[5].parse::<u64>().expect("<end_block> not a valid u64");
let blocks = end.saturating_sub(start);
format!("SELECT index_block_hash FROM staging_blocks ORDER BY index_block_hash ASC LIMIT {start}, {blocks}")
format!("SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0 ORDER BY index_block_hash ASC LIMIT {start}, {blocks}")
}
Some("last") => format!(
"SELECT index_block_hash FROM staging_blocks ORDER BY height DESC LIMIT {}",
"SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0 ORDER BY height DESC LIMIT {}",
argv[4]
),
Some(_) => print_help_and_exit(),
// Default to ALL blocks
None => "SELECT index_block_hash FROM staging_blocks".into(),
None => "SELECT index_block_hash FROM staging_blocks WHERE orphaned = 0".into(),
};

let mut stmt = conn.prepare(&query).unwrap();
Expand Down

0 comments on commit ebb6aac

Please sign in to comment.