Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include tx confirmation status in bulk /block/txs response #41

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,17 @@ fn handle_request(
}
(&Method::GET, Some(&INTERNAL_PREFIX), Some(&"block"), Some(hash), Some(&"txs"), None) => {
let hash = BlockHash::from_hex(hash)?;
let block_id = query.chain().blockid_by_hash(&hash);
let txs = query
.chain()
.get_block_txs(&hash)
.ok_or_else(|| HttpError::not_found("Block not found".to_string()))?
.into_iter()
.map(|tx| (tx, None))
.map(|tx| (tx, block_id.clone()))
.collect();

json_response(prepare_txs(txs, query, config), TTL_SHORT)
let ttl = ttl_by_depth(block_id.map(|b| b.height), query);
json_response(prepare_txs(txs, query, config), ttl)
}
(&Method::GET, Some(&"block"), Some(hash), Some(&"header"), None, None) => {
let hash = BlockHash::from_hex(hash)?;
Expand Down