Browse Source

Rename MonitorEvent to MonitorAttestation

The way I see it, an oracle "event" consists of both an "announcement"
and an "attestation". In the case of this message, we want to keep
track of the state of the "attestation", so the rename should make it
unambiguous.
refactor/no-log-handler
Lucas Soriano del Pino 3 years ago
parent
commit
11e2771c45
No known key found for this signature in database GPG Key ID: EE611E973A1530E7
  1. 4
      daemon/src/maker_cfd.rs
  2. 8
      daemon/src/oracle.rs
  3. 4
      daemon/src/taker_cfd.rs

4
daemon/src/maker_cfd.rs

@ -590,7 +590,7 @@ impl Actor {
.with_context(|| format!("Announcement {} not found", cfd.order.oracle_event_id))?; .with_context(|| format!("Announcement {} not found", cfd.order.oracle_event_id))?;
self.oracle_actor self.oracle_actor
.do_send_async(oracle::MonitorEvent { .do_send_async(oracle::MonitorAttestation {
event_id: offer_announcement.id.clone(), event_id: offer_announcement.id.clone(),
}) })
.await?; .await?;
@ -781,7 +781,7 @@ impl Actor {
.await?; .await?;
self.oracle_actor self.oracle_actor
.do_send_async(oracle::MonitorEvent { .do_send_async(oracle::MonitorAttestation {
event_id: announcement.id.clone(), event_id: announcement.id.clone(),
}) })
.await?; .await?;

8
daemon/src/oracle.rs

@ -34,7 +34,7 @@ pub struct Sync;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct FetchAnnouncement(pub OracleEventId); pub struct FetchAnnouncement(pub OracleEventId);
pub struct MonitorEvent { pub struct MonitorAttestation {
pub event_id: OracleEventId, pub event_id: OracleEventId,
} }
@ -214,8 +214,8 @@ where
} }
#[async_trait] #[async_trait]
impl<CFD: 'static, M: 'static> xtra::Handler<MonitorEvent> for Actor<CFD, M> { impl<CFD: 'static, M: 'static> xtra::Handler<MonitorAttestation> for Actor<CFD, M> {
async fn handle(&mut self, msg: MonitorEvent, _ctx: &mut xtra::Context<Self>) { async fn handle(&mut self, msg: MonitorAttestation, _ctx: &mut xtra::Context<Self>) {
if !self.pending_attestations.insert(msg.event_id.clone()) { if !self.pending_attestations.insert(msg.event_id.clone()) {
tracing::trace!("Attestation {} already being monitored", msg.event_id); tracing::trace!("Attestation {} already being monitored", msg.event_id);
} }
@ -320,7 +320,7 @@ where
impl xtra::Message for Sync { impl xtra::Message for Sync {
type Result = (); type Result = ();
} }
impl xtra::Message for MonitorEvent { impl xtra::Message for MonitorAttestation {
type Result = (); type Result = ();
} }

4
daemon/src/taker_cfd.rs

@ -293,7 +293,7 @@ impl Actor {
.with_context(|| format!("Announcement {} not found", cfd.order.oracle_event_id))?; .with_context(|| format!("Announcement {} not found", cfd.order.oracle_event_id))?;
self.oracle_actor self.oracle_actor
.do_send_async(oracle::MonitorEvent { .do_send_async(oracle::MonitorAttestation {
event_id: offer_announcement.id.clone(), event_id: offer_announcement.id.clone(),
}) })
.await?; .await?;
@ -402,7 +402,7 @@ impl Actor {
.with_context(|| format!("Announcement {} not found", oracle_event_id))?; .with_context(|| format!("Announcement {} not found", oracle_event_id))?;
self.oracle_actor self.oracle_actor
.do_send_async(oracle::MonitorEvent { .do_send_async(oracle::MonitorAttestation {
event_id: announcement.id.clone(), event_id: announcement.id.clone(),
}) })
.await?; .await?;

Loading…
Cancel
Save