Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
made tag and address lookup back to normal
Browse files Browse the repository at this point in the history
  • Loading branch information
Brord van Wierst committed Sep 18, 2020
1 parent de49d1a commit 759e405
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions iota-streams-app/src/transport/tangle/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,29 +404,16 @@ fn handle_client_result<T>(result: iota_client::Result<T>) -> Result<T> {
}

async fn get_bundles(tx_address: Address, tx_tag: Tag) -> Result<Vec<Transaction>> {
let find_resp_addr = handle_client_result(
iota_client::Client::find_transactions()
.addresses(&vec![tx_address][..])
.send()
.await,
)?;
ensure!(!find_resp_addr.hashes.is_empty(), "Transaction hashes not found.");
let find_resp_tags = handle_client_result(
let find_bundles = handle_client_result(
iota_client::Client::find_transactions()
.tags(&vec![tx_tag][..])
.addresses(&vec![tx_address][..])
.send()
.await,
)?;
ensure!(!find_resp_tags.hashes.is_empty(), "Transaction hashes not found.");

let mut hashes = Vec::new();
for hash in find_resp_tags.hashes {
if find_resp_addr.hashes.contains(&hash) {
hashes.push(hash);
}
}
ensure!(!find_bundles.hashes.is_empty(), "Transaction hashes not found.");

let get_resp = handle_client_result(iota_client::Client::get_trytes(&hashes).await)?;
let get_resp = handle_client_result(iota_client::Client::get_trytes(&find_bundles.hashes).await)?;
ensure!(!get_resp.trytes.is_empty(), "Transactions not found.");
Ok(get_resp.trytes)
}
Expand Down

0 comments on commit 759e405

Please sign in to comment.