-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get_hashes_by_auction_id implementation for multiple settlements (#2976)
# Description Fixes #2975 # Changes <!-- List of detailed changes (how the change is accomplished) --> - [ ] ... - [ ] ... ## How to test <!--- Include details of how to test your changes, including any pre-requisites. If no unit tests are included, please explain why and how to test manually 1. 2. 3. --> <!-- ## Related Issues Fixes # -->
- Loading branch information
Showing
4 changed files
with
32 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
use {anyhow::Context, primitive_types::H256}; | ||
|
||
impl super::Postgres { | ||
pub async fn find_tx_hash_by_auction_id( | ||
&self, | ||
auction_id: i64, | ||
) -> anyhow::Result<Option<H256>> { | ||
pub async fn find_settlement_transactions(&self, auction_id: i64) -> anyhow::Result<Vec<H256>> { | ||
let _timer = super::Metrics::get() | ||
.database_queries | ||
.with_label_values(&["find_tx_hash_by_auction_id"]) | ||
.with_label_values(&["find_settlement_transactions"]) | ||
.start_timer(); | ||
|
||
let mut ex = self.pool.acquire().await.context("acquire")?; | ||
let hash = database::settlements::get_hash_by_auction_id(&mut ex, auction_id) | ||
let hashes = database::settlements::get_hashes_by_auction_id(&mut ex, auction_id) | ||
.await | ||
.context("get_hash_by_auction_id")?; | ||
Ok(hash.map(|hash| H256(hash.0))) | ||
.context("get_hashes_by_auction_id")? | ||
.into_iter() | ||
.map(|hash| H256(hash.0)) | ||
.collect(); | ||
Ok(hashes) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters