@@ -7906,6 +7906,7 @@ mod tests {
79067906 use bitcoin:: hashes:: Hash ;
79077907 use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
79087908 use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
7909+ #[ cfg( feature = "std" ) ]
79097910 use core:: time:: Duration ;
79107911 use core:: sync:: atomic:: Ordering ;
79117912 use crate :: events:: { Event , HTLCDestination , MessageSendEvent , MessageSendEventsProvider , ClosureReason } ;
@@ -7931,9 +7932,9 @@ mod tests {
79317932
79327933 // All nodes start with a persistable update pending as `create_network` connects each node
79337934 // with all other nodes to make most tests simpler.
7934- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7935- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7936- assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7935+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7936+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7937+ assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79377938
79387939 let mut chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
79397940
@@ -7947,28 +7948,28 @@ mod tests {
79477948 & nodes[ 0 ] . node . get_our_node_id ( ) ) . pop ( ) . unwrap ( ) ;
79487949
79497950 // The first two nodes (which opened a channel) should now require fresh persistence
7950- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7951- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7951+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7952+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79527953 // ... but the last node should not.
7953- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7954+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79547955 // After persisting the first two nodes they should no longer need fresh persistence.
7955- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7956- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7956+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7957+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79577958
79587959 // Node 3, unrelated to the only channel, shouldn't care if it receives a channel_update
79597960 // about the channel.
79607961 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79617962 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7962- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7963+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79637964
79647965 // The nodes which are a party to the channel should also ignore messages from unrelated
79657966 // parties.
79667967 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79677968 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
79687969 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79697970 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7970- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7971- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7971+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7972+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79727973
79737974 // At this point the channel info given by peers should still be the same.
79747975 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
@@ -7985,17 +7986,17 @@ mod tests {
79857986 // persisted and that its channel info remains the same.
79867987 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_update) ;
79877988 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & bs_update) ;
7988- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7989- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7989+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7990+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79907991 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
79917992 assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
79927993
79937994 // Finally, deliver the other peers' message, ensuring each node needs to be persisted and
79947995 // the channel info has updated.
79957996 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_update) ;
79967997 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & as_update) ;
7997- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7998- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7998+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7999+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79998000 assert_ne ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
80008001 assert_ne ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
80018002 }
0 commit comments