Browse Source

Merge #782

782: Use `xtra-productivty` for `TakeOffer` r=thomaseizinger a=thomaseizinger

This reduces one layer of indirection.


Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
feature/reconnect-button
bors[bot] 3 years ago
committed by GitHub
parent
commit
fad87be0bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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