Skip to content

Commit

Permalink
src/bin/mempool-space_block_txs.rs:handle start_index:mod 25
Browse files Browse the repository at this point in the history
  • Loading branch information
RandyMcMillan committed Sep 24, 2024
1 parent 0ceda01 commit 2ad42dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ pub const URL: &[&str] = &[
#[allow(dead_code)]
/// mempool.space onion api
/// <http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/api>
pub const TOR_URL: &[&str] =
&["http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/api"];
pub const TOR_URL: &[&str] = &["http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/api"];

/// const API_VERSION: &str = "v1";
///
Expand Down
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ impl Args {
if matches.opt_present("block_txs") {
let arg_block_txs = matches.opt_str("block_txs");
let arg_start_index = matches.opt_str("start_index");
block_txs(&arg_block_txs.unwrap(), &arg_start_index.unwrap());
block_txs(&arg_block_txs.unwrap(), &arg_start_index.unwrap_or(String::from("0")));
std::process::exit(0);
}
if matches.opt_present("blocks") {
Expand Down
9 changes: 9 additions & 0 deletions src/bin/mempool-space_block_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ fn main() {
if args.len() == 2 {
let block = &args[1];
let _res = blocking(&format!("block/{}/txs", &block));
} else if args.len() == 3 {
let block = &args[1];
let start_index = &args[2];

let arg_2_mod_25_must_be_zero = args[2].parse::<usize>().unwrap() % 25;

if arg_2_mod_25_must_be_zero == 0 {
let _res = blocking(&format!("block/{}/txs/{}", &block, &start_index));
}
} else {
// silence is golden
std::process::exit(0);
Expand Down

0 comments on commit 2ad42dc

Please sign in to comment.