Skip to content

Commit f8b6d45

Browse files
committed
Remove local file access and networking tests
1 parent fb6d8d1 commit f8b6d45

File tree

1 file changed

+0
-85
lines changed
  • lightning-graph-sync/src

1 file changed

+0
-85
lines changed

lightning-graph-sync/src/lib.rs

-85
Original file line numberDiff line numberDiff line change
@@ -51,88 +51,3 @@ where
5151
let mut file = File::open(sync_path)?;
5252
processing::read_network_graph(&network_graph, &mut file, &chain_source)
5353
}
54-
55-
#[cfg(test)]
56-
mod tests {
57-
use std::time::Instant;
58-
use bitcoin::blockdata::constants::genesis_block;
59-
use bitcoin::Network;
60-
61-
use lightning::routing::network_graph::NetworkGraph;
62-
63-
use crate::error::GraphSyncError;
64-
use crate::{sync_network_graph_with_file_path, sync_network_graph_with_url};
65-
66-
67-
68-
#[tokio::test]
69-
async fn test_http_request() {
70-
let block_hash = genesis_block(Network::Bitcoin).block_hash();
71-
let network_graph = NetworkGraph::new(block_hash);
72-
73-
let chain_source: Option<Box<dyn lightning::chain::Access>> = None;
74-
75-
let sync_result = sync_network_graph_with_url(
76-
&network_graph,
77-
"localhost",
78-
3000,
79-
"delta/500",
80-
&chain_source,
81-
)
82-
.await;
83-
84-
if !sync_result.is_ok() {
85-
let error_string = match sync_result.as_ref().unwrap_err() {
86-
GraphSyncError::IOError(error) => error.to_string(),
87-
GraphSyncError::DecodeError(error) => error.to_string(),
88-
GraphSyncError::LightningError(error) => (&error.err).to_string(),
89-
GraphSyncError::ProcessingError(error) => error.to_string(),
90-
};
91-
println!("Error: {}", error_string);
92-
}
93-
94-
assert!(sync_result.is_ok())
95-
}
96-
97-
#[test]
98-
fn test_file_load() {
99-
let block_hash = genesis_block(Network::Bitcoin).block_hash();
100-
let network_graph = NetworkGraph::new(block_hash);
101-
102-
let chain_source: Option<Box<dyn lightning::chain::Access>> = None;
103-
104-
let start = Instant::now();
105-
106-
// let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/full_compressed.lngossip";
107-
// let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/full_incremental.lngossip";
108-
// let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/one_day_incremental.lngossip";
109-
// let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/one_day.lngossip";
110-
// let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/one_week.lngossip";
111-
112-
// initialize full graph
113-
let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/test_starting_reference.lngossip";
114-
let initialization_result = sync_network_graph_with_file_path(
115-
&network_graph,
116-
path,
117-
&chain_source,
118-
);
119-
if initialization_result.is_err() {
120-
panic!("initialization failed");
121-
}
122-
123-
let path = "/Users/arik/Developer/rust-lightning/lightning-graph-sync/res/test_incremental_delta.lngossip";
124-
let sync_result = sync_network_graph_with_file_path(
125-
&network_graph,
126-
path,
127-
&chain_source,
128-
);
129-
if sync_result.is_err() {
130-
panic!("sync failed");
131-
}
132-
133-
let duration = start.elapsed();
134-
let elapsed_time = format!("{:?}", duration);
135-
136-
println!("sync result: {}, time: {}", sync_result.is_ok(), elapsed_time);
137-
}
138-
}

0 commit comments

Comments
 (0)