@@ -35,27 +35,33 @@ mod tests {
3535
3636 #[ async_trait:: async_trait]
3737 impl key_wallet_manager:: wallet_interface:: WalletInterface for MockWallet {
38- async fn process_block ( & mut self , block : & Block , height : u32 ) -> Vec < dashcore:: Txid > {
38+ async fn process_block (
39+ & mut self ,
40+ block : & Block ,
41+ height : u32 ,
42+ _network : Network ,
43+ ) -> Vec < dashcore:: Txid > {
3944 let mut processed = self . processed_blocks . lock ( ) . await ;
4045 processed. push ( ( block. block_hash ( ) , height) ) ;
4146
4247 // Return txids of all transactions in block as "relevant"
4348 block. txdata . iter ( ) . map ( |tx| tx. txid ( ) ) . collect ( )
4449 }
4550
46- async fn process_mempool_transaction ( & mut self , tx : & Transaction ) {
51+ async fn process_mempool_transaction ( & mut self , tx : & Transaction , _network : Network ) {
4752 let mut processed = self . processed_transactions . lock ( ) . await ;
4853 processed. push ( tx. txid ( ) ) ;
4954 }
5055
51- async fn handle_reorg ( & mut self , _from_height : u32 , _to_height : u32 ) {
56+ async fn handle_reorg ( & mut self , _from_height : u32 , _to_height : u32 , _network : Network ) {
5257 // Not tested here
5358 }
5459
5560 async fn check_compact_filter (
5661 & self ,
57- _filter : & [ u8 ] ,
62+ _filter : & dashcore :: bip158 :: BlockFilter ,
5863 _block_hash : & dashcore:: BlockHash ,
64+ _network : Network ,
5965 ) -> bool {
6066 // Return true for all filters in test
6167 true
@@ -91,6 +97,7 @@ mod tests {
9197 watch_items,
9298 stats,
9399 event_tx,
100+ Network :: Dash ,
94101 ) ;
95102
96103 ( processor, task_tx, event_rx, wallet, storage)
@@ -169,9 +176,10 @@ mod tests {
169176
170177 // Send filter processing task
171178 let ( response_tx, response_rx) = oneshot:: channel ( ) ;
179+ let filter = dashcore:: bip158:: BlockFilter :: new ( & filter_data) ;
172180 task_tx
173181 . send ( BlockProcessingTask :: ProcessCompactFilter {
174- filter_data : filter_data . clone ( ) ,
182+ filter ,
175183 block_hash,
176184 response_tx,
177185 } )
@@ -219,18 +227,30 @@ mod tests {
219227
220228 #[ async_trait:: async_trait]
221229 impl key_wallet_manager:: wallet_interface:: WalletInterface for NonMatchingWallet {
222- async fn process_block ( & mut self , _block : & Block , _height : u32 ) -> Vec < dashcore:: Txid > {
230+ async fn process_block (
231+ & mut self ,
232+ _block : & Block ,
233+ _height : u32 ,
234+ _network : Network ,
235+ ) -> Vec < dashcore:: Txid > {
223236 Vec :: new ( )
224237 }
225238
226- async fn process_mempool_transaction ( & mut self , _tx : & Transaction ) { }
239+ async fn process_mempool_transaction ( & mut self , _tx : & Transaction , _network : Network ) { }
227240
228- async fn handle_reorg ( & mut self , _from_height : u32 , _to_height : u32 ) { }
241+ async fn handle_reorg (
242+ & mut self ,
243+ _from_height : u32 ,
244+ _to_height : u32 ,
245+ _network : Network ,
246+ ) {
247+ }
229248
230249 async fn check_compact_filter (
231250 & self ,
232- _filter : & [ u8 ] ,
251+ _filter : & dashcore :: bip158 :: BlockFilter ,
233252 _block_hash : & dashcore:: BlockHash ,
253+ _network : Network ,
234254 ) -> bool {
235255 // Always return false - filter doesn't match
236256 false
@@ -250,17 +270,25 @@ mod tests {
250270 let storage = Arc :: new ( Mutex :: new ( MemoryStorageManager :: new ( ) . await . unwrap ( ) ) ) ;
251271 let watch_items = Arc :: new ( RwLock :: new ( HashSet :: new ( ) ) ) ;
252272
253- let mut processor =
254- BlockProcessor :: new ( task_rx, wallet, storage, watch_items, stats, event_tx) ;
273+ let mut processor = BlockProcessor :: new (
274+ task_rx,
275+ wallet,
276+ storage,
277+ watch_items,
278+ stats,
279+ event_tx,
280+ Network :: Dash ,
281+ ) ;
255282
256283 let block_hash = create_test_block ( Network :: Dash ) . block_hash ( ) ;
257284 let filter_data = vec ! [ 1 , 2 , 3 , 4 , 5 ] ;
258285
259286 // Send filter processing task
260287 let ( response_tx, response_rx) = oneshot:: channel ( ) ;
288+ let filter = dashcore:: bip158:: BlockFilter :: new ( & filter_data) ;
261289 task_tx
262290 . send ( BlockProcessingTask :: ProcessCompactFilter {
263- filter_data ,
291+ filter ,
264292 block_hash,
265293 response_tx,
266294 } )
0 commit comments