Skip to content

Commit 2e4333e

Browse files
committed
Apply review comments on provider conditions
1 parent 7882370 commit 2e4333e

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

mithril-aggregator/src/database/provider/signer_registration.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,10 @@ impl<'client> SignerRegistrationRecordProvider<'client> {
168168
Self { client }
169169
}
170170

171-
fn condition_by_signer_id_and_epoch(
172-
&self,
173-
signer_id: String,
174-
epoch: &Epoch,
175-
) -> Result<WhereCondition, StdError> {
176-
let epoch = i64::try_from(epoch.0).unwrap();
177-
171+
fn condition_by_signer_id(&self, signer_id: String) -> Result<WhereCondition, StdError> {
178172
Ok(WhereCondition::new(
179-
"signer_id = ?1 and epoch_setting_id = ?2",
180-
vec![Value::String(signer_id), Value::Integer(epoch)],
173+
"signer_id = ?*",
174+
vec![Value::String(signer_id)],
181175
))
182176
}
183177

@@ -196,7 +190,9 @@ impl<'client> SignerRegistrationRecordProvider<'client> {
196190
signer_id: String,
197191
epoch: &Epoch,
198192
) -> Result<EntityCursor<SignerRegistrationRecord>, StdError> {
199-
let filters = self.condition_by_signer_id_and_epoch(signer_id, epoch)?;
193+
let filters = self
194+
.condition_by_signer_id(signer_id)?
195+
.and_where(self.condition_by_epoch(epoch)?);
200196
let signer_registration_record = self.find(filters)?;
201197

202198
Ok(signer_registration_record)
@@ -252,7 +248,7 @@ impl<'conn> UpdateSignerRegistrationRecordProvider<'conn> {
252248
signer_registration_record: SignerRegistrationRecord,
253249
) -> WhereCondition {
254250
WhereCondition::new(
255-
"(signer_id, epoch_setting_id, verification_key, verification_key_signature, operational_certificate, kes_period, stake, created_at) values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)",
251+
"(signer_id, epoch_setting_id, verification_key, verification_key_signature, operational_certificate, kes_period, stake, created_at) values (?*, ?*, ?*, ?*, ?*, ?*, ?*, ?*)",
256252
vec![
257253
Value::String(signer_registration_record.signer_id),
258254
Value::Integer(

0 commit comments

Comments
 (0)