mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-04-25 18:29:09 -04:00
parent
2212758d17
commit
638143a10d
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -1151,6 +1151,12 @@ dependencies = [
|
|||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "get-port"
|
||||||
|
version = "3.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac6c41a39c60ae1fc5bf0e220347ce90fa1e4bb0fcdac65b09bb5f4576bebc84"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "get_if_addrs"
|
name = "get_if_addrs"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@ -3312,6 +3318,7 @@ dependencies = [
|
|||||||
"ecdsa_fun",
|
"ecdsa_fun",
|
||||||
"futures",
|
"futures",
|
||||||
"genawaiter",
|
"genawaiter",
|
||||||
|
"get-port",
|
||||||
"hyper",
|
"hyper",
|
||||||
"libp2p",
|
"libp2p",
|
||||||
"libp2p-tokio-socks5",
|
"libp2p-tokio-socks5",
|
||||||
|
@ -48,6 +48,7 @@ void = "1"
|
|||||||
xmr-btc = { path = "../xmr-btc" }
|
xmr-btc = { path = "../xmr-btc" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
get-port = "3"
|
||||||
hyper = "0.13"
|
hyper = "0.13"
|
||||||
port_check = "0.1"
|
port_check = "0.1"
|
||||||
spectral = "0.6"
|
spectral = "0.6"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::testutils::{init_alice, init_bob};
|
use crate::testutils::{init_alice, init_bob};
|
||||||
use futures::future::try_join;
|
use futures::future::try_join;
|
||||||
|
use get_port::get_port;
|
||||||
use libp2p::Multiaddr;
|
use libp2p::Multiaddr;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use swap::{alice, bob};
|
use swap::{alice, bob};
|
||||||
@ -35,8 +36,8 @@ async fn happy_path() {
|
|||||||
let xmr_alice = xmr_to_swap * 10;
|
let xmr_alice = xmr_to_swap * 10;
|
||||||
let xmr_bob = xmr_btc::monero::Amount::ZERO;
|
let xmr_bob = xmr_btc::monero::Amount::ZERO;
|
||||||
|
|
||||||
// todo: This should not be hardcoded
|
let port = get_port().expect("Failed to find a free port");
|
||||||
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9876"
|
let alice_multiaddr: Multiaddr = format!("/ip4/127.0.0.1/tcp/{}", port)
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse Alice's address");
|
.expect("failed to parse Alice's address");
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
|
use crate::testutils::{init_alice, init_bob};
|
||||||
|
use get_port::get_port;
|
||||||
use libp2p::Multiaddr;
|
use libp2p::Multiaddr;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
|
use std::convert::TryFrom;
|
||||||
use swap::{alice, alice::swap::AliceState, bitcoin, bob, storage::Database};
|
use swap::{alice, alice::swap::AliceState, bitcoin, bob, storage::Database};
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
use testcontainers::clients::Cli;
|
use testcontainers::clients::Cli;
|
||||||
|
use testutils::init_tracing;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use xmr_btc::config::Config;
|
use xmr_btc::config::Config;
|
||||||
|
|
||||||
pub mod testutils;
|
pub mod testutils;
|
||||||
|
|
||||||
use crate::testutils::{init_alice, init_bob};
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
use testutils::init_tracing;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||||
let _guard = init_tracing();
|
let _guard = init_tracing();
|
||||||
@ -31,7 +31,8 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
|||||||
let bob_btc_starting_balance = btc_to_swap * 10;
|
let bob_btc_starting_balance = btc_to_swap * 10;
|
||||||
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
||||||
|
|
||||||
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9877"
|
let port = get_port().expect("Failed to find a free port");
|
||||||
|
let alice_multiaddr: Multiaddr = format!("/ip4/127.0.0.1/tcp/{}", port)
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse Alice's address");
|
.expect("failed to parse Alice's address");
|
||||||
|
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
|
use crate::testutils::{init_alice, init_bob};
|
||||||
|
use get_port::get_port;
|
||||||
use libp2p::Multiaddr;
|
use libp2p::Multiaddr;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use swap::{alice, bitcoin, bob, storage::Database};
|
use std::convert::TryFrom;
|
||||||
|
use swap::{alice, bitcoin, bob, bob::swap::BobState, storage::Database};
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
use testcontainers::clients::Cli;
|
use testcontainers::clients::Cli;
|
||||||
|
use testutils::init_tracing;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use xmr_btc::config::Config;
|
use xmr_btc::config::Config;
|
||||||
|
|
||||||
pub mod testutils;
|
pub mod testutils;
|
||||||
|
|
||||||
use crate::testutils::{init_alice, init_bob};
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
use swap::bob::swap::BobState;
|
|
||||||
use testutils::init_tracing;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||||
let _guard = init_tracing();
|
let _guard = init_tracing();
|
||||||
@ -32,7 +31,8 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
|||||||
let bob_btc_starting_balance = btc_to_swap * 10;
|
let bob_btc_starting_balance = btc_to_swap * 10;
|
||||||
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
||||||
|
|
||||||
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9877"
|
let port = get_port().expect("Failed to find a free port");
|
||||||
|
let alice_multiaddr: Multiaddr = format!("/ip4/127.0.0.1/tcp/{}", port)
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse Alice's address");
|
.expect("failed to parse Alice's address");
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::testutils::{init_alice, init_bob};
|
use crate::testutils::{init_alice, init_bob};
|
||||||
use futures::future::try_join;
|
use futures::future::try_join;
|
||||||
|
use get_port::get_port;
|
||||||
use libp2p::Multiaddr;
|
use libp2p::Multiaddr;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use swap::{alice, alice::swap::AliceState, bob, bob::swap::BobState};
|
use swap::{alice, alice::swap::AliceState, bob, bob::swap::BobState};
|
||||||
@ -33,8 +34,8 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
|
|||||||
let alice_btc_starting_balance = bitcoin::Amount::ZERO;
|
let alice_btc_starting_balance = bitcoin::Amount::ZERO;
|
||||||
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
||||||
|
|
||||||
// todo: This should not be hardcoded
|
let port = get_port().expect("Failed to find a free port");
|
||||||
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9877"
|
let alice_multiaddr: Multiaddr = format!("/ip4/127.0.0.1/tcp/{}", port)
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse Alice's address");
|
.expect("failed to parse Alice's address");
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::testutils::{init_alice, init_bob};
|
use crate::testutils::{init_alice, init_bob};
|
||||||
use futures::future::try_join;
|
use futures::future::try_join;
|
||||||
|
use get_port::get_port;
|
||||||
use libp2p::Multiaddr;
|
use libp2p::Multiaddr;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use swap::{alice, alice::swap::AliceState, bob, bob::swap::BobState, storage::Database};
|
use swap::{alice, alice::swap::AliceState, bob, bob::swap::BobState, storage::Database};
|
||||||
@ -35,8 +36,8 @@ async fn given_alice_restarts_after_xmr_is_locked_abort_swap() {
|
|||||||
let alice_btc_starting_balance = bitcoin::Amount::ZERO;
|
let alice_btc_starting_balance = bitcoin::Amount::ZERO;
|
||||||
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
let alice_xmr_starting_balance = xmr_to_swap * 10;
|
||||||
|
|
||||||
// todo: This should not be hardcoded
|
let port = get_port().expect("Failed to find a free port");
|
||||||
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9879"
|
let alice_multiaddr: Multiaddr = format!("/ip4/127.0.0.1/tcp/{}", port)
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse Alice's address");
|
.expect("failed to parse Alice's address");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user