Fix rebase conflicts

pull/35/head
rishflab 4 years ago
parent 620216a596
commit 379aff50cf

@ -18,7 +18,10 @@ pub enum Options {
#[structopt(default_value = "http://127.0.0.1:8332", long = "bitcoind")]
bitcoind_url: Url,
#[structopt(default_value = "http://127.0.0.1:18083/json_rpc", long = "monero_wallet_rpc")]
#[structopt(
default_value = "http://127.0.0.1:18083/json_rpc",
long = "monero_wallet_rpc"
)]
monero_wallet_rpc_url: Url,
#[structopt(
@ -43,7 +46,10 @@ pub enum Options {
#[structopt(default_value = "http://127.0.0.1:8332", long = "bitcoind")]
bitcoind_url: Url,
#[structopt(default_value = "http://127.0.0.1:18083/json_rpc", long = "monero_wallet_rpc")]
#[structopt(
default_value = "http://127.0.0.1:18083/json_rpc",
long = "monero_wallet_rpc"
)]
monero_wallet_rpc_url: Url,
#[structopt(
@ -63,7 +69,16 @@ pub enum Options {
#[structopt(default_value = "http://127.0.0.1:8332", long = "bitcoind")]
bitcoind_url: Url,
#[structopt(default_value = "http://127.0.0.1:18083/json_rpc", long = "monerod")]
monerod_url: Url,
#[structopt(
default_value = "http://127.0.0.1:18083/json_rpc",
long = "monero_wallet_rpc"
)]
monero_wallet_rpc_url: Url,
#[structopt(
default_value = "http://127.0.0.1:18084",
long = "monero_watch_only_wallet_rpc"
)]
monero_watch_only_wallet_rpc_url: Url,
},
}

@ -156,13 +156,15 @@ async fn main() -> Result<()> {
Options::Recover {
swap_id,
bitcoind_url,
monerod_url,
monero_wallet_rpc_url,
monero_watch_only_wallet_rpc_url,
} => {
let state = db.get_state(swap_id)?;
let bitcoin_wallet = bitcoin::Wallet::new("bob", bitcoind_url)
.await
.expect("failed to create bitcoin wallet");
let monero_wallet = monero::Wallet::new(monerod_url);
let monero_wallet =
monero::Facade::new(monero_wallet_rpc_url, monero_watch_only_wallet_rpc_url);
recover(bitcoin_wallet, monero_wallet, state).await?;
}

@ -2,7 +2,7 @@ use anyhow::Result;
use async_trait::async_trait;
use backoff::{backoff::Constant as ConstantBackoff, future::FutureOperation as _};
use futures::TryFutureExt;
use monero::{Address, Network, PrivateKey};
use monero::{Address, Network};
use monero_harness::rpc::wallet;
use std::time::Duration;
use url::Url;

@ -29,8 +29,8 @@ use xmr_btc::bitcoin::{
};
pub async fn recover(
bitcoin_wallet: bitcoin::Wallet,
monero_wallet: monero::Wallet,
bitcoin_wallet: crate::bitcoin::Wallet,
monero_wallet: crate::monero::Facade,
state: Swap,
) -> Result<()> {
match state {
@ -40,8 +40,8 @@ pub async fn recover(
}
pub async fn alice_recover(
bitcoin_wallet: bitcoin::Wallet,
monero_wallet: monero::Wallet,
bitcoin_wallet: crate::bitcoin::Wallet,
monero_wallet: crate::monero::Facade,
state: Alice,
) -> Result<()> {
match state {
@ -368,7 +368,7 @@ pub async fn alice_recover(
pub async fn bob_recover(
bitcoin_wallet: crate::bitcoin::Wallet,
monero_wallet: crate::monero::Wallet,
monero_wallet: crate::monero::Facade,
state: Bob,
) -> Result<()> {
match state {

@ -74,22 +74,26 @@ async fn swap() {
let alice_behaviour = alice::Alice::default();
let alice_transport = build(alice_behaviour.identity()).unwrap();
let db = Database::open(std::path::Path::new("../.swap-db/")).unwrap(); let alice_swap = alice::swap(
let db = Database::open(std::path::Path::new("../.swap-db/")).unwrap();
let alice_swap = alice::swap(
alice_btc_wallet.clone(),
alice_xmr_wallet.clone(),db,
alice_xmr_wallet.clone(),
db,
alice_multiaddr.clone(),
alice_transport,
alice_behaviour,
);
let db_dir = tempdir().unwrap();
let db = Database::open(db_dir.path()).unwrap();let (cmd_tx, mut _cmd_rx) = mpsc::channel(1);
let db = Database::open(db_dir.path()).unwrap();
let (cmd_tx, mut _cmd_rx) = mpsc::channel(1);
let (mut rsp_tx, rsp_rx) = mpsc::channel(1);
let bob_behaviour = bob::Bob::default();
let bob_transport = build(bob_behaviour.identity()).unwrap();
let bob_swap = bob::swap(
bob_btc_wallet.clone(),
bob_xmr_wallet.clone(),db,
bob_xmr_wallet.clone(),
db,
btc.as_sat(),
alice_multiaddr,
cmd_tx,

Loading…
Cancel
Save