mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-06 05:24:42 -04:00
Split SendReceive into seperate traits
This commit is contained in:
parent
6b7193b974
commit
154b3edcf9
4 changed files with 21 additions and 8 deletions
|
@ -3,7 +3,7 @@ use crate::{
|
|||
bitcoin::{BroadcastSignedTransaction, WatchForRawTransaction},
|
||||
bob, monero,
|
||||
monero::{CreateWalletForOutput, Transfer},
|
||||
transport::SendReceive,
|
||||
transport::{Receive, Send},
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use ecdsa_fun::{
|
||||
|
@ -21,7 +21,7 @@ pub async fn next_state<
|
|||
R: RngCore + CryptoRng,
|
||||
B: WatchForRawTransaction + BroadcastSignedTransaction,
|
||||
M: CreateWalletForOutput + Transfer,
|
||||
T: SendReceive<Message, bob::Message>,
|
||||
T: Send<Message> + Receive<bob::Message>,
|
||||
>(
|
||||
bitcoin_wallet: &B,
|
||||
monero_wallet: &M,
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
},
|
||||
monero,
|
||||
monero::{CheckTransfer, CreateWalletForOutput},
|
||||
transport::SendReceive,
|
||||
transport::{Receive, Send},
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use ecdsa_fun::{
|
||||
|
@ -25,7 +25,7 @@ pub async fn next_state<
|
|||
R: RngCore + CryptoRng,
|
||||
B: WatchForRawTransaction + SignTxLock + BuildTxLockPsbt + BroadcastSignedTransaction,
|
||||
M: CreateWalletForOutput + CheckTransfer,
|
||||
T: SendReceive<Message, alice::Message>,
|
||||
T: Send<Message> + Receive<alice::Message>,
|
||||
>(
|
||||
bitcoin_wallet: &B,
|
||||
monero_wallet: &M,
|
||||
|
|
|
@ -2,7 +2,11 @@ use anyhow::Result;
|
|||
use async_trait::async_trait;
|
||||
|
||||
#[async_trait]
|
||||
pub trait SendReceive<SendMsg, RecvMsg> {
|
||||
pub trait Send<SendMsg> {
|
||||
async fn send_message(&mut self, message: SendMsg) -> Result<()>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait Receive<RecvMsg> {
|
||||
async fn receive_message(&mut self) -> Result<RecvMsg>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue