Browse Source

Use `xtra-productivty` for `TakeOffer`

This reduces one layer of indirection.
feature/reconnect-button
Thomas Eizinger 3 years ago
parent
commit
b515d90a66
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 27
      daemon/src/taker_cfd.rs

27
daemon/src/taker_cfd.rs

@ -384,18 +384,16 @@ where
}
}
#[xtra_productivity]
impl<O, M, W> Actor<O, M, W>
where
Self: xtra::Handler<Completed>,
O: xtra::Handler<oracle::GetAnnouncement> + xtra::Handler<oracle::MonitorAttestation>,
W: xtra::Handler<wallet::BuildPartyParams> + xtra::Handler<wallet::Sign>,
{
async fn handle_take_offer(
&mut self,
order_id: OrderId,
quantity: Usd,
ctx: &mut Context<Self>,
) -> Result<()> {
async fn handle_take_offer(&mut self, msg: TakeOffer, ctx: &mut Context<Self>) -> Result<()> {
let TakeOffer { order_id, quantity } = msg;
let disconnected = self
.setup_actors
.get_disconnected(order_id)
@ -627,19 +625,6 @@ where
}
}
#[async_trait]
impl<O: 'static, M: 'static, W: 'static> Handler<TakeOffer> for Actor<O, M, W>
where
Self: xtra::Handler<Completed>,
O: xtra::Handler<oracle::GetAnnouncement> + xtra::Handler<oracle::MonitorAttestation>,
W: xtra::Handler<wallet::BuildPartyParams> + xtra::Handler<wallet::Sign>,
{
async fn handle(&mut self, msg: TakeOffer, ctx: &mut Context<Self>) -> Result<()> {
self.handle_take_offer(msg.order_id, msg.quantity, ctx)
.await
}
}
#[async_trait]
impl<O: 'static, M: 'static, W: 'static> Handler<wire::MakerToTaker> for Actor<O, M, W>
where
@ -732,10 +717,6 @@ impl<O: 'static, M: 'static, W: 'static> Handler<setup_taker::Started> for Actor
}
}
impl Message for TakeOffer {
type Result = Result<()>;
}
impl Message for CfdRollOverCompleted {
type Result = ();
}

Loading…
Cancel
Save