-
Notifications
You must be signed in to change notification settings - Fork 90
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
Get_hashes_by_auction_id implementation for multiple settlements #2976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved assuming more PRs will come after this one.
Ok(Some(hash)) => return Ok(hash), | ||
Ok(hashes) if hashes.is_empty() => {} | ||
Ok(hashes) => { | ||
if let Some(hash) = hashes.into_iter().next() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks quite ugly. Could be a bit nicer with:
match self
.persistence
.find_settlement_transactions(auction_id)
.await
.map(|mut hashes| hashes.pop())
{
Ok(Some(tx_hash)) => return Ok(tx_hash),
Ok(None) => {},
Err(err) => {
tracing::warn!(?err, "failed to fetch recent settlement tx hashes");
}
}
&self, | ||
auction_id: i64, | ||
) -> anyhow::Result<Option<H256>> { | ||
pub async fn find_settlement_transactions(&self, auction_id: i64) -> anyhow::Result<Vec<H256>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this function might as well be inlined in the infra
module to get rid of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is missing a meaningful description and I'm not sure it's actually fulfilling the desired logic (or at least not fully). Once we submit multiple solutions we want all of them to succeed before considering wait_for_settlement_transaction
done and continuing the runloop. Now we would wait for one to get included and move on which seems incorrect.
The scope of the PR is limited. It's not supposed to adjust the /settle logic. We have a separate task for that in #2830 (comment) |
Description
Fixes #2975
Changes
How to test