@@ -7851,6 +7851,7 @@ mod tests {
7851
7851
use bitcoin:: hashes:: Hash ;
7852
7852
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
7853
7853
use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
7854
+ #[ cfg( feature = "std" ) ]
7854
7855
use core:: time:: Duration ;
7855
7856
use core:: sync:: atomic:: Ordering ;
7856
7857
use crate :: events:: { Event , HTLCDestination , MessageSendEvent , MessageSendEventsProvider , ClosureReason } ;
@@ -7876,9 +7877,9 @@ mod tests {
7876
7877
7877
7878
// All nodes start with a persistable update pending as `create_network` connects each node
7878
7879
// 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 ( ) ) ;
7882
7883
7883
7884
let mut chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7884
7885
@@ -7892,28 +7893,28 @@ mod tests {
7892
7893
& nodes[ 0 ] . node . get_our_node_id ( ) ) . pop ( ) . unwrap ( ) ;
7893
7894
7894
7895
// 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 ( ) ) ;
7897
7898
// ... 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 ( ) ) ;
7899
7900
// 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 ( ) ) ;
7902
7903
7903
7904
// Node 3, unrelated to the only channel, shouldn't care if it receives a channel_update
7904
7905
// about the channel.
7905
7906
nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7906
7907
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 ( ) ) ;
7908
7909
7909
7910
// The nodes which are a party to the channel should also ignore messages from unrelated
7910
7911
// parties.
7911
7912
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7912
7913
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7913
7914
nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7914
7915
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 ( ) ) ;
7917
7918
7918
7919
// At this point the channel info given by peers should still be the same.
7919
7920
assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
@@ -7930,17 +7931,17 @@ mod tests {
7930
7931
// persisted and that its channel info remains the same.
7931
7932
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_update) ;
7932
7933
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 ( ) ) ;
7935
7936
assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
7936
7937
assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
7937
7938
7938
7939
// Finally, deliver the other peers' message, ensuring each node needs to be persisted and
7939
7940
// the channel info has updated.
7940
7941
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_update) ;
7941
7942
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 ( ) ) ;
7944
7945
assert_ne ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
7945
7946
assert_ne ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
7946
7947
}
0 commit comments