@@ -559,14 +559,15 @@ mod tests {
559
559
let bg_processor = BackgroundProcessor :: start ( persister, event_handler, nodes[ 0 ] . chain_monitor . clone ( ) , nodes[ 0 ] . node . clone ( ) , nodes[ 0 ] . net_graph_msg_handler . clone ( ) , nodes[ 0 ] . peer_manager . clone ( ) , nodes[ 0 ] . logger . clone ( ) ) ;
560
560
561
561
macro_rules! check_persisted_data {
562
- ( $node: expr, $filepath: expr, $expected_bytes: expr) => {
562
+ ( $node: expr, $filepath: expr) => {
563
+ let mut expected_bytes = Vec :: new( ) ;
563
564
loop {
564
- $ expected_bytes. clear( ) ;
565
- match $node. write( & mut $ expected_bytes) {
565
+ expected_bytes. clear( ) ;
566
+ match $node. write( & mut expected_bytes) {
566
567
Ok ( ( ) ) => {
567
568
match std:: fs:: read( $filepath) {
568
569
Ok ( bytes) => {
569
- if bytes == $ expected_bytes {
570
+ if bytes == expected_bytes {
570
571
break
571
572
} else {
572
573
continue
@@ -583,8 +584,7 @@ mod tests {
583
584
584
585
// Check that the initial channel manager data is persisted as expected.
585
586
let filepath = get_full_filepath ( "test_background_processor_persister_0" . to_string ( ) , "manager" . to_string ( ) ) ;
586
- let mut expected_bytes = Vec :: new ( ) ;
587
- check_persisted_data ! ( nodes[ 0 ] . node, filepath. clone( ) , expected_bytes) ;
587
+ check_persisted_data ! ( nodes[ 0 ] . node, filepath. clone( ) ) ;
588
588
589
589
loop {
590
590
if !nodes[ 0 ] . node . get_persistence_condvar_value ( ) { break }
@@ -594,18 +594,16 @@ mod tests {
594
594
nodes[ 0 ] . node . force_close_channel ( & OutPoint { txid : tx. txid ( ) , index : 0 } . to_channel_id ( ) ) . unwrap ( ) ;
595
595
596
596
// Check that the force-close updates are persisted.
597
- let mut expected_bytes = Vec :: new ( ) ;
598
- check_persisted_data ! ( nodes[ 0 ] . node, filepath. clone( ) , expected_bytes) ;
597
+ check_persisted_data ! ( nodes[ 0 ] . node, filepath. clone( ) ) ;
599
598
loop {
600
599
if !nodes[ 0 ] . node . get_persistence_condvar_value ( ) { break }
601
600
}
602
601
603
602
// Check network graph is persisted
604
603
let filepath = get_full_filepath ( "test_background_processor_persister_0" . to_string ( ) , "network_graph" . to_string ( ) ) ;
605
- let mut expected_bytes = Vec :: new ( ) ;
606
604
if let Some ( ref handler) = nodes[ 0 ] . net_graph_msg_handler {
607
605
let network_graph = handler. network_graph ( ) ;
608
- check_persisted_data ! ( network_graph, filepath. clone( ) , expected_bytes ) ;
606
+ check_persisted_data ! ( network_graph, filepath. clone( ) ) ;
609
607
}
610
608
611
609
assert ! ( bg_processor. stop( ) . is_ok( ) ) ;
0 commit comments