Skip to content

Commit de99ae3

Browse files
authored
Merge branch 'mempool' into mononaut/block-tx-confs
2 parents ae9fc93 + 157dbf2 commit de99ae3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/rest.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,29 @@ fn handle_request(
10251025
json_response(tx.remove(0), ttl)
10261026
}
10271027
}
1028+
(&Method::POST, Some(&INTERNAL_PREFIX), Some(&"txs"), None, None, None) => {
1029+
let txid_strings: Vec<String> =
1030+
serde_json::from_slice(&body).map_err(|err| HttpError::from(err.to_string()))?;
1031+
1032+
match txid_strings
1033+
.into_iter()
1034+
.map(|txid| Txid::from_hex(&txid))
1035+
.collect::<Result<Vec<Txid>, _>>()
1036+
{
1037+
Ok(txids) => {
1038+
let txs: Vec<(Transaction, Option<BlockId>)> = txids
1039+
.iter()
1040+
.filter_map(|txid| {
1041+
query
1042+
.lookup_txn(txid)
1043+
.map(|tx| (tx, query.chain().tx_confirming_block(txid)))
1044+
})
1045+
.collect();
1046+
json_response(prepare_txs(txs, query, config), 0)
1047+
}
1048+
Err(err) => http_message(StatusCode::BAD_REQUEST, err.to_string(), 0),
1049+
}
1050+
}
10281051
(&Method::GET, Some(&"tx"), Some(hash), Some(out_type @ &"hex"), None, None)
10291052
| (&Method::GET, Some(&"tx"), Some(hash), Some(out_type @ &"raw"), None, None) => {
10301053
let hash = Txid::from_hex(hash)?;

0 commit comments

Comments
 (0)