Fix rebase conflicts

This commit is contained in:
rishflab 2020-11-13 13:33:36 +11:00
parent 620216a596
commit 379aff50cf
5 changed files with 37 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -74,22 +74,26 @@ async fn swap() {
let alice_behaviour = alice::Alice::default(); let alice_behaviour = alice::Alice::default();
let alice_transport = build(alice_behaviour.identity()).unwrap(); 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_btc_wallet.clone(),
alice_xmr_wallet.clone(),db, alice_xmr_wallet.clone(),
db,
alice_multiaddr.clone(), alice_multiaddr.clone(),
alice_transport, alice_transport,
alice_behaviour, alice_behaviour,
); );
let db_dir = tempdir().unwrap(); 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 (mut rsp_tx, rsp_rx) = mpsc::channel(1);
let bob_behaviour = bob::Bob::default(); let bob_behaviour = bob::Bob::default();
let bob_transport = build(bob_behaviour.identity()).unwrap(); let bob_transport = build(bob_behaviour.identity()).unwrap();
let bob_swap = bob::swap( let bob_swap = bob::swap(
bob_btc_wallet.clone(), bob_btc_wallet.clone(),
bob_xmr_wallet.clone(),db, bob_xmr_wallet.clone(),
db,
btc.as_sat(), btc.as_sat(),
alice_multiaddr, alice_multiaddr,
cmd_tx, cmd_tx,