Skip to content

Commit 292f497

Browse files
committed
src/args.rs:src/lib.rs:blocks_tip_height
1 parent bd1918b commit 292f497

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/args.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ impl Args {
223223
opts.optopt("", "block_raw", "block-raw api call", "BLOCK_RAW");
224224
opts.optopt("", "block_status", "block-status api call", "BLOCK_STATUS");
225225

226+
opts.optflag("", "blocks_tip_height", "GET /api/blocks/tip/height api call");
227+
226228
//OPTOPT
227229
opts.optopt("c", "config", "sets the configuration file", "CONFIG");
228230
opts.optopt("s", "server", "sets the address of the rustypaste server", "SERVER");
@@ -331,6 +333,11 @@ impl Args {
331333
generic_sys_call("block_status", &block_status.unwrap());
332334
std::process::exit(0);
333335
}
336+
if matches.opt_present("blocks_tip_height") {
337+
let blocks_tip_height = matches.opt_str("blocks_tip_height");
338+
generic_sys_call("blocks_tip_height", &"");
339+
std::process::exit(0);
340+
}
334341

335342
if matches.opt_present("h")
336343
|| (matches.free.is_empty()

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ mod tests {
346346
);
347347
wait("100");
348348
}
349+
fn test_blocks_tip_height() {
350+
// GET /api/blocks/tip/height
351+
let binding = format!("blocks_tip_height").clone();
352+
let block_raw: &str = blocking(&binding).expect("returns current block_height");
353+
let block_raw = generic_sys_call("blocks_tip_height", "extraneous_arg");
354+
wait("100");
355+
}
349356
#[test]
350357
fn test_blockheight() {
351358
let blockheight = blockheight::blockheight();

0 commit comments

Comments
 (0)