Update get_current_consensus_context
Update the get_current_consensus_context operation to not check for the
highest epoch when getting the current context. There should only be
one context per service_id in the database now so this operation just
needs to return the context for the given service_id.
@@ -45,7 +45,6 @@ where
self.conn.transaction::<_, _, _>(|| {
let context = consensus_2pc_context::table
.filter(consensus_2pc_context::service_id.eq(format!("{}", service_id)))
- .order(consensus_2pc_context::epoch.desc())
.first::<Consensus2pcContextModel>(self.conn)
.optional()?;
@@ -54,8 +53,7 @@ where
consensus_2pc_context_participant::table
.filter(
consensus_2pc_context_participant::service_id
- .eq(format!("{}", service_id))
- .and(consensus_2pc_context_participant::epoch.eq(context.epoch)),
+ .eq(format!("{}", service_id)),
)
.load::<Consensus2pcContextParticipantModel>(self.conn)?;
