made tag and address lookup back to normal
@@ -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)
}
