Skip to content

Commit bd1918b

Browse files
committed
src/args.rs:--block_status
1 parent f0dd7eb commit bd1918b

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/args.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ impl Args {
221221
opts.optopt("", "block_height", "block-height api call", "BLOCK_HEIGHT");
222222
opts.optopt("", "blocks_timestamp", "blocks-timestamp api call", "BLOCKS_TIMESTAMP");
223223
opts.optopt("", "block_raw", "block-raw api call", "BLOCK_RAW");
224+
opts.optopt("", "block_status", "block-status api call", "BLOCK_STATUS");
224225

225226
//OPTOPT
226227
opts.optopt("c", "config", "sets the configuration file", "CONFIG");
@@ -325,6 +326,11 @@ impl Args {
325326
generic_sys_call("block_raw", &block_raw.unwrap());
326327
std::process::exit(0);
327328
}
329+
if matches.opt_present("block_status") {
330+
let block_status = matches.opt_str("block_status");
331+
generic_sys_call("block_status", &block_status.unwrap());
332+
std::process::exit(0);
333+
}
328334

329335
if matches.opt_present("h")
330336
|| (matches.free.is_empty()

src/bin/mempool-space_block_status.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use std::env;
44
fn main() {
55
{
66
let args: Vec<String> = env::args().collect();
7-
let mut address = &String::from("");
7+
let mut block_hash = &String::from("");
88
if args.len() > 1 {
9-
address = &args[1];
9+
block_hash = &args[1];
1010
} else {
1111
// silence is golden
1212
std::process::exit(0);
1313
}
14-
let _res = blocking(&format!("/address/{}", &address));
14+
let _res = blocking(&format!("/block/{}/status", &block_hash));
1515
}
1616
}

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ mod tests {
336336
wait("100");
337337
}
338338

339+
fn test_block_status() {
340+
// GET /api/block/:hash/status
341+
let binding = format!("block/0000000000000000000065bda8f8a88f2e1e00d9a6887a43d640e52a4c7660f2").clone();
342+
let block_raw: &str = blocking(&binding).expect("an existing block hash is needed");
343+
let block_raw = generic_sys_call(
344+
"block_status",
345+
"0000000000000000000065bda8f8a88f2e1e00d9a6887a43d640e52a4c7660f2",
346+
);
347+
wait("100");
348+
}
339349
#[test]
340350
fn test_blockheight() {
341351
let blockheight = blockheight::blockheight();

0 commit comments

Comments
 (0)