diff --git a/src/rest.rs b/src/rest.rs index 9e92246e..625f7643 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -1128,6 +1128,29 @@ fn handle_request( json_response(prepare_txs(txs, query, config), TTL_SHORT) } + (&Method::POST, Some(&"mempool"), Some(&"txs"), None, None, None) => { + let txid_strings: Vec = + serde_json::from_slice(&body).map_err(|err| HttpError::from(err.to_string()))?; + + match txid_strings + .into_iter() + .map(|txid| Txid::from_hex(&txid)) + .collect::, _>>() + { + Ok(txids) => { + let txs: Vec<(Transaction, Option)> = { + let mempool = query.mempool(); + txids + .iter() + .filter_map(|txid| mempool.lookup_txn(txid).map(|tx| (tx, None))) + .collect() + }; + + json_response(prepare_txs(txs, query, config), 0) + } + Err(err) => http_message(StatusCode::BAD_REQUEST, err.to_string(), 0), + } + } (&Method::GET, Some(&"mempool"), Some(&"txs"), last_seen_txid, None, None) => { let last_seen_txid = last_seen_txid.and_then(|txid| Txid::from_hex(txid).ok()); let txs = query