Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
jbesraa committed Oct 1, 2024
1 parent 90c109d commit 59f5324
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 1,173 deletions.
1 change: 1 addition & 0 deletions roles/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions roles/tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ minreq = { version = "2.12.0", features = ["https"] }
once_cell = "1.19.0"
tar = "0.4.41"
tokio = { version="1.36.0",features = ["full","tracing"] }
# demand-easy-sv2 = { version = "0.6.0", git = "https://github.com/demand-open-source/demand-easy-sv2.git" }

async-channel = "1.5.1"
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2"] }
const_sv2 = { path = "../../protocols/v2/const-sv2" }
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
Expand Down
20 changes: 11 additions & 9 deletions roles/tests-integration/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
pub mod sniffer;

use bitcoind::{bitcoincore_rpc::RpcApi, BitcoinD, Conf};
use flate2::read::GzDecoder;
use key_utils::{Secp256k1PublicKey, Secp256k1SecretKey};
use once_cell::sync::Lazy;
use pool_sv2::PoolSv2;
use proxy::SV2Proxy;
use sniffer::Sniffer;
use std::{
collections::HashSet,
env,
Expand All @@ -16,8 +18,6 @@ use std::{
};
use tar::Archive;

pub mod proxy;

// prevents get_available_port from ever returning the same port twice
static UNIQUE_PORTS: Lazy<Mutex<HashSet<u16>>> = Lazy::new(|| Mutex::new(HashSet::new()));

Expand Down Expand Up @@ -266,13 +266,13 @@ pub async fn start_template_provider(tp_port: u16) -> TemplateProvider {
template_provider
}

pub async fn start_proxy(upstream: SocketAddr, downstream: SocketAddr) -> SV2Proxy {
let proxy = SV2Proxy::new();
let proxy_clone = proxy.clone();
pub async fn start_sniffer(upstream: SocketAddr, downstream: SocketAddr) -> Sniffer {
let sniffer = Sniffer::new(downstream, upstream).await;
let sniffer_clone = sniffer.clone();
tokio::spawn(async move {
proxy_clone.start(upstream, downstream).await;
sniffer_clone.start().await;
});
proxy
sniffer
}

pub async fn start_poolsv2(
Expand All @@ -288,7 +288,9 @@ pub async fn start_poolsv2(
let pool = test_pool.pool.clone();
let pool_clone = pool.clone();
tokio::task::spawn(async move {
assert!(pool_clone.start().await.is_ok());
let ret = pool_clone.start().await;
dbg!(&ret);
assert!(ret.is_ok());
});
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
pool
Expand Down
Loading

0 comments on commit 59f5324

Please sign in to comment.