mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
filter outputs by tx_id (#1298)
This commit is contained in:
parent
70b97b0a06
commit
a053790ee6
1 changed files with 18 additions and 2 deletions
|
@ -158,12 +158,22 @@ where
|
|||
api: &mut APIOwner<T, C, K>,
|
||||
) -> Result<(bool, Vec<OutputData>), Error> {
|
||||
let mut update_from_node = false;
|
||||
let mut id = None;
|
||||
let mut show_spent = false;
|
||||
if let Ok(params) = req.get_ref::<UrlEncodedQuery>() {
|
||||
if let Some(_) = params.get("refresh") {
|
||||
update_from_node = true;
|
||||
}
|
||||
if let Some(_) = params.get("show_spent") {
|
||||
show_spent = true;
|
||||
}
|
||||
if let Some(ids) = params.get("tx_id") {
|
||||
for i in ids {
|
||||
id = Some(i.parse().unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
api.retrieve_outputs(false, update_from_node, None)
|
||||
api.retrieve_outputs(show_spent, update_from_node, id)
|
||||
}
|
||||
|
||||
fn retrieve_txs(
|
||||
|
@ -171,13 +181,19 @@ where
|
|||
req: &mut Request,
|
||||
api: &mut APIOwner<T, C, K>,
|
||||
) -> Result<(bool, Vec<TxLogEntry>), Error> {
|
||||
let mut id = None;
|
||||
let mut update_from_node = false;
|
||||
if let Ok(params) = req.get_ref::<UrlEncodedQuery>() {
|
||||
if let Some(_) = params.get("refresh") {
|
||||
update_from_node = true;
|
||||
}
|
||||
if let Some(ids) = params.get("id") {
|
||||
for i in ids {
|
||||
id = Some(i.parse().unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
api.retrieve_txs(update_from_node, None)
|
||||
api.retrieve_txs(update_from_node, id)
|
||||
}
|
||||
|
||||
fn retrieve_summary_info(
|
||||
|
|
Loading…
Reference in a new issue