#[cfg(feature = "utxo-commitments")]
use blvm_node::network::utxo_commitments_client::UtxoCommitmentsClient;
#[cfg(feature = "utxo-commitments")]
use blvm_protocol::utxo_commitments::UtxoCommitmentsNetworkClient;
#[cfg(feature = "utxo-commitments")]
use std::sync::Arc;
#[cfg(feature = "utxo-commitments")]
use tokio::sync::RwLock;
#[cfg(feature = "utxo-commitments")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_utxo_commitments_client_creation() {
use blvm_node::network::NetworkManager;
use std::net::SocketAddr;
let network_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
let network_manager = NetworkManager::new(network_addr);
let network_manager_arc = Arc::new(RwLock::new(network_manager));
let _client = UtxoCommitmentsClient::new(network_manager_arc);
assert!(true);
}
#[cfg(feature = "utxo-commitments")]
#[test]
fn test_utxo_commitments_client_peer_id_parsing() {
let tcp_peer_id = "tcp:127.0.0.1:8333";
assert!(tcp_peer_id.starts_with("tcp:"));
#[cfg(feature = "iroh")]
{
let iroh_peer_id = "iroh:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
assert!(iroh_peer_id.starts_with("iroh:"));
}
let invalid_peer_id = "invalid:format";
assert!(!invalid_peer_id.starts_with("tcp:"));
#[cfg(feature = "iroh")]
{
assert!(!invalid_peer_id.starts_with("iroh:"));
}
}
#[cfg(feature = "utxo-commitments")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_utxo_commitments_client_get_peer_ids() {
use blvm_node::network::NetworkManager;
use std::net::SocketAddr;
let network_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
let network_manager = NetworkManager::new(network_addr);
let network_manager_arc = Arc::new(RwLock::new(network_manager));
let client = UtxoCommitmentsClient::new(network_manager_arc);
let peer_ids = client.get_peer_ids();
assert!(peer_ids.is_empty() || !peer_ids.is_empty());
}
#[cfg(not(feature = "utxo-commitments"))]
#[test]
fn test_utxo_commitments_feature_not_enabled() {
assert!(true);
}