@@ -7906,6 +7906,7 @@ mod tests {
7906
7906
use bitcoin:: hashes:: Hash ;
7907
7907
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
7908
7908
use bitcoin:: secp256k1:: { PublicKey , Secp256k1 , SecretKey } ;
7909
+ #[ cfg( feature = "std" ) ]
7909
7910
use core:: time:: Duration ;
7910
7911
use core:: sync:: atomic:: Ordering ;
7911
7912
use crate :: events:: { Event , HTLCDestination , MessageSendEvent , MessageSendEventsProvider , ClosureReason } ;
@@ -7931,9 +7932,9 @@ mod tests {
7931
7932
7932
7933
// All nodes start with a persistable update pending as `create_network` connects each node
7933
7934
// 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 ( ) ) ;
7937
7938
7938
7939
let mut chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7939
7940
@@ -7947,28 +7948,28 @@ mod tests {
7947
7948
& nodes[ 0 ] . node . get_our_node_id ( ) ) . pop ( ) . unwrap ( ) ;
7948
7949
7949
7950
// 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 ( ) ) ;
7952
7953
// ... 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 ( ) ) ;
7954
7955
// 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 ( ) ) ;
7957
7958
7958
7959
// Node 3, unrelated to the only channel, shouldn't care if it receives a channel_update
7959
7960
// about the channel.
7960
7961
nodes[ 2 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7961
7962
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 ( ) ) ;
7963
7964
7964
7965
// The nodes which are a party to the channel should also ignore messages from unrelated
7965
7966
// parties.
7966
7967
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7967
7968
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 1 ) ;
7968
7969
nodes[ 1 ] . node . handle_channel_update ( & nodes[ 2 ] . node . get_our_node_id ( ) , & chan. 0 ) ;
7969
7970
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 ( ) ) ;
7972
7973
7973
7974
// At this point the channel info given by peers should still be the same.
7974
7975
assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
@@ -7985,17 +7986,17 @@ mod tests {
7985
7986
// persisted and that its channel info remains the same.
7986
7987
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_update) ;
7987
7988
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 ( ) ) ;
7990
7991
assert_eq ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
7991
7992
assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
7992
7993
7993
7994
// Finally, deliver the other peers' message, ensuring each node needs to be persisted and
7994
7995
// the channel info has updated.
7995
7996
nodes[ 0 ] . node . handle_channel_update ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_update) ;
7996
7997
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 ( ) ) ;
7999
8000
assert_ne ! ( nodes[ 0 ] . node. list_channels( ) [ 0 ] , node_a_chan_info) ;
8000
8001
assert_ne ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] , node_b_chan_info) ;
8001
8002
}
0 commit comments