File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ impl PeerNetworkManager {
8080
8181 let discovery = DnsDiscovery :: new ( ) . await ?;
8282 let data_dir = config. storage_path . clone ( ) . unwrap_or_else ( || PathBuf :: from ( "." ) ) ;
83+
8384 let peer_store = PersistentPeerStorage :: open ( data_dir. clone ( ) ) . await ?;
8485
8586 let reputation_manager = Arc :: new ( PeerReputationManager :: new ( ) ) ;
Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ impl PersistentPeerStorage {
5555#[ async_trait]
5656impl PersistentStorage for PersistentPeerStorage {
5757 async fn open ( storage_path : impl Into < PathBuf > + Send ) -> StorageResult < Self > {
58+ let storage_path = storage_path. into ( ) ;
59+
5860 Ok ( PersistentPeerStorage {
59- storage_path : storage_path. into ( ) . join ( Self :: FOLDER_NAME ) ,
61+ storage_path : storage_path. join ( Self :: FOLDER_NAME ) ,
6062 } )
6163 }
6264
Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ async fn test_handshake_timeout() {
7272
7373#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
7474async fn test_network_manager_creation ( ) {
75- let config = ClientConfig :: new ( Network :: Dash ) ;
75+ let temp_dir = tempfile:: TempDir :: new ( ) . expect ( "Failed to create temporary directory" ) ;
76+ let config = ClientConfig :: new ( Network :: Dash ) . with_storage_path ( temp_dir. path ( ) . to_path_buf ( ) ) ;
7677 let network = PeerNetworkManager :: new ( & config) . await ;
7778
7879 assert ! ( network. is_ok( ) , "Network manager creation should succeed" ) ;
Original file line number Diff line number Diff line change @@ -261,9 +261,11 @@ async fn test_header_sync_performance() {
261261#[ tokio:: test]
262262async fn test_header_sync_with_client_integration ( ) {
263263 let _ = env_logger:: try_init ( ) ;
264+ let temp_dir = tempfile:: TempDir :: new ( ) . expect ( "Failed to create temporary directory" ) ;
264265
265266 // Test header sync integration with the full client
266267 let config = ClientConfig :: new ( Network :: Dash )
268+ . with_storage_path ( temp_dir. path ( ) . to_path_buf ( ) )
267269 . with_validation_mode ( ValidationMode :: Basic )
268270 . with_connection_timeout ( Duration :: from_secs ( 10 ) ) ;
269271
Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ use key_wallet_manager::wallet_manager::WalletManager;
1515/// Create a test SPV client with memory storage for integration testing.
1616async fn create_test_client (
1717) -> DashSpvClient < WalletManager < ManagedWalletInfo > , PeerNetworkManager , DiskStorageManager > {
18- let config = ClientConfig :: testnet ( ) . without_filters ( ) . without_masternodes ( ) ;
18+ let temp_dir = tempfile:: TempDir :: new ( ) . expect ( "Failed to create temporary directory" ) ;
19+ let config = ClientConfig :: testnet ( )
20+ . without_filters ( )
21+ . without_masternodes ( )
22+ . with_storage_path ( temp_dir. path ( ) . to_path_buf ( ) ) ;
1923
2024 // Create network manager
2125 let network_manager = PeerNetworkManager :: new ( & config) . await . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments