Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check if coin already in cache #1549

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hal3e
Copy link
Contributor

@hal3e hal3e commented Nov 25, 2024

Summary

Checks if any of the inputs is already cached before sending/submitting the tx.

Comment on lines 44 to 60
pub fn find_already_inserted<'a>(
&mut self,
coin_ids: impl IntoIterator<Item = (&'a (Bech32Address, AssetId), &'a Vec<CoinTypeId>)>,
) -> Option<(CoinCacheKey, CoinTypeId)> {
for (key, ids) in coin_ids {
if let Some(items) = self.items.get(key) {
for id in ids {
if items.contains(&CoinCacheItem::new(id.clone())) {
return Some((key.clone(), id.clone()));
}
}
}
}

None
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be rewritten somewhere else using get_active ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants