diff --git a/xmr-btc/src/lib.rs b/xmr-btc/src/lib.rs index 3d6e80dc..0430b567 100644 --- a/xmr-btc/src/lib.rs +++ b/xmr-btc/src/lib.rs @@ -76,8 +76,9 @@ pub enum Action { } // TODO: This could be moved to the monero module +#[async_trait] pub trait ReceiveTransferProof { - fn receive_transfer_proof(&self) -> monero::TransferProof; + async fn receive_transfer_proof(&mut self) -> monero::TransferProof; } #[async_trait] @@ -90,7 +91,7 @@ pub trait MedianTime { /// This is called post handshake, after all the keys, addresses and most of the /// signatures have been exchanged. pub fn action_generator_bob( - network: &'static N, + network: &'static mut N, monero_ledger: &'static M, bitcoin_ledger: &'static B, // TODO: Replace this with a new, slimmer struct? @@ -150,7 +151,7 @@ where futures::pin_mut!(poll_until_btc_has_expired); // the source of this could be the database, this layer doesn't care - let transfer_proof = network.receive_transfer_proof(); + let transfer_proof = network.receive_transfer_proof().await; let S_b_monero = monero::PublicKey::from_private_key(&monero::PrivateKey::from_scalar( s_b.into_ed25519(), diff --git a/xmr-btc/tests/on_chain.rs b/xmr-btc/tests/on_chain.rs index 20e937b7..a5781189 100644 --- a/xmr-btc/tests/on_chain.rs +++ b/xmr-btc/tests/on_chain.rs @@ -1,6 +1,7 @@ pub mod harness; use anyhow::Result; +use async_trait::async_trait; use genawaiter::GeneratorState; use harness::wallet::{bitcoin, monero}; use xmr_btc::{ @@ -13,14 +14,15 @@ use xmr_btc::{ struct Network; +#[async_trait] impl ReceiveTransferProof for Network { - fn receive_transfer_proof(&self) -> xmr_btc::monero::TransferProof { + async fn receive_transfer_proof(&mut self) -> xmr_btc::monero::TransferProof { todo!("use libp2p") } } async fn swap_as_bob( - network: &'static Network, + network: &'static mut Network, monero_wallet: &'static monero::BobWallet<'static>, bitcoin_wallet: &'static bitcoin::Wallet, state: bob::State2,