Browse Source

Migrate `do_send_async` to `send`

If we fail to deliver `NotifySettlementAccepted`, we just clean-up
our internal state.
pAndLAndPayout
Thomas Eizinger 3 years ago
parent
commit
7f0a218502
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 24
      daemon/src/maker_cfd.rs

24
daemon/src/maker_cfd.rs

@ -346,17 +346,27 @@ where
let taker_id = self.get_taker_id_of_proposal(&order_id)?;
self.takers
.do_send_async(maker_inc_connections::TakerMessage {
match self
.takers
.send(maker_inc_connections::TakerMessage {
taker_id,
command: TakerCommand::NotifySettlementAccepted { id: order_id },
})
.await?;
.await?
{
Ok(_) => {
self.current_agreed_proposals
.insert(order_id, self.get_settlement_proposal(order_id)?);
self.remove_pending_proposal(&order_id)
.context("accepted settlement")?;
}
Err(e) => {
tracing::warn!("Failed to notify taker of accepted settlement: {}", e);
self.remove_pending_proposal(&order_id)
.context("accepted settlement")?;
}
}
self.current_agreed_proposals
.insert(order_id, self.get_settlement_proposal(order_id)?);
self.remove_pending_proposal(&order_id)
.context("accepted settlement")?;
Ok(())
}

Loading…
Cancel
Save