mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-25 09:01:21 -05:00
Make ReceiveTransferProof async and take &mut self
This commit is contained in:
parent
3492c46e71
commit
176b2195e3
@ -76,8 +76,9 @@ pub enum Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This could be moved to the monero module
|
// TODO: This could be moved to the monero module
|
||||||
|
#[async_trait]
|
||||||
pub trait ReceiveTransferProof {
|
pub trait ReceiveTransferProof {
|
||||||
fn receive_transfer_proof(&self) -> monero::TransferProof;
|
async fn receive_transfer_proof(&mut self) -> monero::TransferProof;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -90,7 +91,7 @@ pub trait MedianTime {
|
|||||||
/// This is called post handshake, after all the keys, addresses and most of the
|
/// This is called post handshake, after all the keys, addresses and most of the
|
||||||
/// signatures have been exchanged.
|
/// signatures have been exchanged.
|
||||||
pub fn action_generator_bob<N, M, B>(
|
pub fn action_generator_bob<N, M, B>(
|
||||||
network: &'static N,
|
network: &'static mut N,
|
||||||
monero_ledger: &'static M,
|
monero_ledger: &'static M,
|
||||||
bitcoin_ledger: &'static B,
|
bitcoin_ledger: &'static B,
|
||||||
// TODO: Replace this with a new, slimmer struct?
|
// TODO: Replace this with a new, slimmer struct?
|
||||||
@ -150,7 +151,7 @@ where
|
|||||||
futures::pin_mut!(poll_until_btc_has_expired);
|
futures::pin_mut!(poll_until_btc_has_expired);
|
||||||
|
|
||||||
// the source of this could be the database, this layer doesn't care
|
// 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(
|
let S_b_monero = monero::PublicKey::from_private_key(&monero::PrivateKey::from_scalar(
|
||||||
s_b.into_ed25519(),
|
s_b.into_ed25519(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
pub mod harness;
|
pub mod harness;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use async_trait::async_trait;
|
||||||
use genawaiter::GeneratorState;
|
use genawaiter::GeneratorState;
|
||||||
use harness::wallet::{bitcoin, monero};
|
use harness::wallet::{bitcoin, monero};
|
||||||
use xmr_btc::{
|
use xmr_btc::{
|
||||||
@ -13,14 +14,15 @@ use xmr_btc::{
|
|||||||
|
|
||||||
struct Network;
|
struct Network;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl ReceiveTransferProof for Network {
|
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")
|
todo!("use libp2p")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn swap_as_bob(
|
async fn swap_as_bob(
|
||||||
network: &'static Network,
|
network: &'static mut Network,
|
||||||
monero_wallet: &'static monero::BobWallet<'static>,
|
monero_wallet: &'static monero::BobWallet<'static>,
|
||||||
bitcoin_wallet: &'static bitcoin::Wallet,
|
bitcoin_wallet: &'static bitcoin::Wallet,
|
||||||
state: bob::State2,
|
state: bob::State2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user