@@ -7822,6 +7822,7 @@ mod tests {
78227822 use bitcoin:: hashes:: Hash ;
78237823 use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
78247824 use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
7825+ #[ cfg( feature = "std" ) ]
78257826 use core:: time:: Duration ;
78267827 use core:: sync:: atomic:: Ordering ;
78277828 use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
@@ -7847,9 +7848,9 @@ mod tests {
78477848
78487849 // All nodes start with a persistable update pending as `create_network` connects each node
78497850 // with all other nodes to make most tests simpler.
7850- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7851- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7852- assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7851+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7852+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7853+ assert ! ( nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78537854
78547855 let mut chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
78557856
@@ -7863,28 +7864,28 @@ mod tests {
78637864 & nodes[ 0 ] . node . get_our_node_id ( ) ) . pop ( ) . unwrap ( ) ;
78647865
78657866 // The first two nodes (which opened a channel) should now require fresh persistence
7866- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7867- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7867+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7868+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78687869 // ... but the last node should not.
7869- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7870+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78707871 // After persisting the first two nodes they should no longer need fresh persistence.
7871- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7872- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7872+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7873+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78737874
78747875 // Node 3, unrelated to the only channel, shouldn't care if it receives a channel_update
78757876 // about the channel.
78767877 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
78777878 nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7878- assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7879+ assert ! ( !nodes[ 2 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78797880
78807881 // The nodes which are a party to the channel should also ignore messages from unrelated
78817882 // parties.
78827883 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
78837884 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
78847885 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
78857886 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7886- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7887- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7887+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7888+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
78887889
78897890 // At this point the channel info given by peers should still be the same.
78907891 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
@@ -7901,17 +7902,17 @@ mod tests {
79017902 // persisted and that its channel info remains the same.
79027903 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_update) ;
79037904 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & bs_update) ;
7904- assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7905- assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7905+ assert ! ( !nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7906+ assert ! ( !nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79067907 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
79077908 assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
79087909
79097910 // Finally, deliver the other peers' message, ensuring each node needs to be persisted and
79107911 // the channel info has updated.
79117912 nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_update) ;
79127913 nodes[ 1 ] . node . handle_channel_update ( & nodes[ 0 ] . node . get_our_node_id ( ) , & as_update) ;
7913- assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7914- assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . wait_timeout ( Duration :: from_millis ( 1 ) ) ) ;
7914+ assert ! ( nodes[ 0 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
7915+ assert ! ( nodes[ 1 ] . node. get_persistable_update_future( ) . poll_is_complete ( ) ) ;
79157916 assert_ne ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
79167917 assert_ne ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
79177918 }
0 commit comments