mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-11-17 15:26:14 +00:00
Use domain types in fn signature instead of messages
This simplifies usage witin the swap module.
This commit is contained in:
parent
64b71d0b16
commit
575893fb51
@ -311,21 +311,23 @@ impl LatestRate for kraken::RateUpdateStream {
|
||||
}
|
||||
|
||||
impl EventLoopHandle {
|
||||
pub async fn recv_encrypted_signature(&mut self) -> Result<EncryptedSignature> {
|
||||
pub async fn recv_encrypted_signature(&mut self) -> Result<bitcoin::EncryptedSignature> {
|
||||
let signature = self
|
||||
.recv_encrypted_signature
|
||||
.take()
|
||||
.context("Encrypted signature was already received")?
|
||||
.await?;
|
||||
.await?
|
||||
.tx_redeem_encsig;
|
||||
|
||||
Ok(signature)
|
||||
}
|
||||
pub async fn send_transfer_proof(&mut self, msg: TransferProof) -> Result<()> {
|
||||
|
||||
pub async fn send_transfer_proof(&mut self, msg: monero::TransferProof) -> Result<()> {
|
||||
if self
|
||||
.send_transfer_proof
|
||||
.take()
|
||||
.context("Transfer proof was already sent")?
|
||||
.send(msg)
|
||||
.send(TransferProof { tx_lock_proof: msg })
|
||||
.is_err()
|
||||
{
|
||||
bail!("Failed to send transfer proof, receiver no longer listening?")
|
||||
|
@ -3,7 +3,6 @@ use crate::bitcoin::{
|
||||
};
|
||||
use crate::protocol::alice;
|
||||
use crate::protocol::alice::event_loop::EventLoopHandle;
|
||||
use crate::protocol::alice::TransferProof;
|
||||
use crate::{bitcoin, monero};
|
||||
use anyhow::{bail, Context, Result};
|
||||
|
||||
@ -27,9 +26,7 @@ pub async fn lock_xmr(
|
||||
// Otherwise Alice might publish the lock tx twice!
|
||||
|
||||
event_loop_handle
|
||||
.send_transfer_proof(TransferProof {
|
||||
tx_lock_proof: transfer_proof,
|
||||
})
|
||||
.send_transfer_proof(transfer_proof)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
@ -45,7 +42,7 @@ pub async fn wait_for_bitcoin_encrypted_signature(
|
||||
|
||||
tracing::debug!("Message 3 received, returning it");
|
||||
|
||||
Ok(msg3.tx_redeem_encsig)
|
||||
Ok(msg3)
|
||||
}
|
||||
|
||||
pub async fn publish_cancel_transaction(
|
||||
|
Loading…
Reference in New Issue
Block a user