|
4 | 4 | mod tests { |
5 | 5 | use crate::client::block_processor::{BlockProcessingTask, BlockProcessor}; |
6 | 6 |
|
7 | | - use crate::storage::memory::MemoryStorageManager; |
8 | | - use crate::storage::StorageManager; |
| 7 | + use crate::storage::DiskStorageManager; |
9 | 8 | use crate::types::{SpvEvent, SpvStats}; |
10 | 9 | use dashcore::{blockdata::constants::genesis_block, Block, Network, Transaction}; |
11 | 10 |
|
@@ -92,17 +91,19 @@ mod tests { |
92 | 91 | } |
93 | 92 |
|
94 | 93 | async fn setup_processor() -> ( |
95 | | - BlockProcessor<MockWallet, MemoryStorageManager>, |
| 94 | + BlockProcessor<MockWallet, DiskStorageManager>, |
96 | 95 | mpsc::UnboundedSender<BlockProcessingTask>, |
97 | 96 | mpsc::UnboundedReceiver<SpvEvent>, |
98 | 97 | Arc<RwLock<MockWallet>>, |
99 | | - Arc<Mutex<MemoryStorageManager>>, |
| 98 | + Arc<Mutex<DiskStorageManager>>, |
100 | 99 | ) { |
101 | 100 | let (task_tx, task_rx) = mpsc::unbounded_channel(); |
102 | 101 | let (event_tx, event_rx) = mpsc::unbounded_channel(); |
103 | 102 | let stats = Arc::new(RwLock::new(SpvStats::default())); |
104 | 103 | let wallet = Arc::new(RwLock::new(MockWallet::new())); |
105 | | - let storage = Arc::new(Mutex::new(MemoryStorageManager::new().await.unwrap())); |
| 104 | + let storage = Arc::new(Mutex::new( |
| 105 | + DiskStorageManager::with_temp_dir().await.expect("Failed to create tmp storage"), |
| 106 | + )); |
106 | 107 | let processor = BlockProcessor::new( |
107 | 108 | task_rx, |
108 | 109 | wallet.clone(), |
@@ -305,7 +306,9 @@ mod tests { |
305 | 306 | let (event_tx, mut event_rx) = mpsc::unbounded_channel(); |
306 | 307 | let stats = Arc::new(RwLock::new(SpvStats::default())); |
307 | 308 | let wallet = Arc::new(RwLock::new(NonMatchingWallet {})); |
308 | | - let storage = Arc::new(Mutex::new(MemoryStorageManager::new().await.unwrap())); |
| 309 | + let storage = Arc::new(Mutex::new( |
| 310 | + DiskStorageManager::with_temp_dir().await.expect("Failed to create tmp storage"), |
| 311 | + )); |
309 | 312 |
|
310 | 313 | let processor = |
311 | 314 | BlockProcessor::new(task_rx, wallet, storage, stats, event_tx, Network::Dash); |
|
0 commit comments