@@ -7851,6 +7851,7 @@ mod tests {
78517851 use bitcoin:: hashes:: Hash ;
78527852 use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
78537853 use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
7854+ #[ cfg( feature = "std" ) ]
78547855 use core:: time:: Duration ;
78557856 use core:: sync:: atomic:: Ordering ;
78567857 use crate :: events:: { Event , HTLCDestination , MessageSendEvent , MessageSendEventsProvider , ClosureReason } ;
@@ -7876,9 +7877,9 @@ mod tests {
78767877
78777878 // All nodes start with a persistable update pending as `create_network` connects each node
78787879 // with all other nodes to make most tests simpler.
7879- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7880- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7881- assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7880+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7881+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7882+ assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78827883
78837884 let mut chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
78847885
@@ -7892,28 +7893,28 @@ mod tests {
78927893 & nodes[ 0 ] . node . get_our_node_id ( ) ) . pop ( ) . unwrap ( ) ;
78937894
78947895 // The first two nodes (which opened a channel) should now require fresh persistence
7895- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7896- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7896+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7897+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78977898 // ... but the last node should not.
7898- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7899+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78997900 // After persisting the first two nodes they should no longer need fresh persistence.
7900- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7901- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7901+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7902+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79027903
79037904 // Node 3, unrelated to the only channel, shouldn't care if it receives a channel_update
79047905 // about the channel.
79057906 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79067907 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7907- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7908+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79087909
79097910 // The nodes which are a party to the channel should also ignore messages from unrelated
79107911 // parties.
79117912 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79127913 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
79137914 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
79147915 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7915- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7916- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7916+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7917+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79177918
79187919 // At this point the channel info given by peers should still be the same.
79197920 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
@@ -7930,17 +7931,17 @@ mod tests {
79307931 // persisted and that its channel info remains the same.
79317932 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_update) ;
79327933 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & bs_update) ;
7933- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7934- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7934+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7935+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79357936 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
79367937 assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
79377938
79387939 // Finally, deliver the other peers' message, ensuring each node needs to be persisted and
79397940 // the channel info has updated.
79407941 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_update) ;
79417942 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & as_update) ;
7942- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7943- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7943+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7944+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79447945 assert_ne ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
79457946 assert_ne ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
79467947 }
0 commit comments