@@ -34,7 +34,7 @@ use crate::util::test_channel_signer::TestChannelSigner;
3434#[ cfg( test) ]
3535use crate :: util:: test_channel_signer:: SignerOp ;
3636use crate :: util:: test_utils;
37- use crate :: util:: test_utils:: { panicking , TestChainMonitor , TestScorer , TestKeysInterface } ;
37+ use crate :: util:: test_utils:: { TestChainMonitor , TestScorer , TestKeysInterface } ;
3838use crate :: util:: ser:: { ReadableArgs , Writeable } ;
3939
4040use bitcoin:: amount:: Amount ;
@@ -194,28 +194,23 @@ impl ConnectStyle {
194194 }
195195
196196 fn random_style ( ) -> ConnectStyle {
197- #[ cfg( feature = "std" ) ] {
198- use core:: hash:: { BuildHasher , Hasher } ;
199- // Get a random value using the only std API to do so - the DefaultHasher
200- let rand_val = std:: collections:: hash_map:: RandomState :: new ( ) . build_hasher ( ) . finish ( ) ;
201- let res = match rand_val % 9 {
202- 0 => ConnectStyle :: BestBlockFirst ,
203- 1 => ConnectStyle :: BestBlockFirstSkippingBlocks ,
204- 2 => ConnectStyle :: BestBlockFirstReorgsOnlyTip ,
205- 3 => ConnectStyle :: TransactionsFirst ,
206- 4 => ConnectStyle :: TransactionsFirstSkippingBlocks ,
207- 5 => ConnectStyle :: TransactionsDuplicativelyFirstSkippingBlocks ,
208- 6 => ConnectStyle :: HighlyRedundantTransactionsFirstSkippingBlocks ,
209- 7 => ConnectStyle :: TransactionsFirstReorgsOnlyTip ,
210- 8 => ConnectStyle :: FullBlockViaListen ,
211- _ => unreachable ! ( ) ,
212- } ;
213- eprintln ! ( "Using Block Connection Style: {:?}" , res) ;
214- res
215- }
216- #[ cfg( not( feature = "std" ) ) ] {
217- ConnectStyle :: FullBlockViaListen
218- }
197+ use core:: hash:: { BuildHasher , Hasher } ;
198+ // Get a random value using the only std API to do so - the DefaultHasher
199+ let rand_val = std:: collections:: hash_map:: RandomState :: new ( ) . build_hasher ( ) . finish ( ) ;
200+ let res = match rand_val % 9 {
201+ 0 => ConnectStyle :: BestBlockFirst ,
202+ 1 => ConnectStyle :: BestBlockFirstSkippingBlocks ,
203+ 2 => ConnectStyle :: BestBlockFirstReorgsOnlyTip ,
204+ 3 => ConnectStyle :: TransactionsFirst ,
205+ 4 => ConnectStyle :: TransactionsFirstSkippingBlocks ,
206+ 5 => ConnectStyle :: TransactionsDuplicativelyFirstSkippingBlocks ,
207+ 6 => ConnectStyle :: HighlyRedundantTransactionsFirstSkippingBlocks ,
208+ 7 => ConnectStyle :: TransactionsFirstReorgsOnlyTip ,
209+ 8 => ConnectStyle :: FullBlockViaListen ,
210+ _ => unreachable ! ( ) ,
211+ } ;
212+ eprintln ! ( "Using Block Connection Style: {:?}" , res) ;
213+ res
219214 }
220215}
221216
@@ -270,9 +265,7 @@ fn do_connect_block_with_consistency_checks<'a, 'b, 'c, 'd>(node: &'a Node<'b, '
270265
271266fn do_connect_block_without_consistency_checks < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , block : Block , skip_intermediaries : bool ) {
272267 let height = node. best_block_info ( ) . 1 + 1 ;
273- #[ cfg( feature = "std" ) ] {
274- eprintln ! ( "Connecting block using Block Connection Style: {:?}" , * node. connect_style. borrow( ) ) ;
275- }
268+ eprintln ! ( "Connecting block using Block Connection Style: {:?}" , * node. connect_style. borrow( ) ) ;
276269 // Update the block internally before handing it over to LDK, to ensure our assertions regarding
277270 // transaction broadcast are correct.
278271 node. blocks . lock ( ) . unwrap ( ) . push ( ( block. clone ( ) , height) ) ;
@@ -340,9 +333,7 @@ fn do_connect_block_without_consistency_checks<'a, 'b, 'c, 'd>(node: &'a Node<'b
340333
341334pub fn disconnect_blocks < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , count : u32 ) {
342335 call_claimable_balances ( node) ;
343- #[ cfg( feature = "std" ) ] {
344- eprintln ! ( "Disconnecting {} blocks using Block Connection Style: {:?}" , count, * node. connect_style. borrow( ) ) ;
345- }
336+ eprintln ! ( "Disconnecting {} blocks using Block Connection Style: {:?}" , count, * node. connect_style. borrow( ) ) ;
346337 for i in 0 ..count {
347338 let orig = node. blocks . lock ( ) . unwrap ( ) . pop ( ) . unwrap ( ) ;
348339 assert ! ( orig. 1 > 0 ) ; // Cannot disconnect genesis
@@ -471,9 +462,7 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> {
471462 }
472463}
473464
474- #[ cfg( feature = "std" ) ]
475465impl < ' a , ' b , ' c > std:: panic:: UnwindSafe for Node < ' a , ' b , ' c > { }
476- #[ cfg( feature = "std" ) ]
477466impl < ' a , ' b , ' c > std:: panic:: RefUnwindSafe for Node < ' a , ' b , ' c > { }
478467impl < ' a , ' b , ' c > Node < ' a , ' b , ' c > {
479468 pub fn best_block_hash ( & self ) -> BlockHash {
@@ -620,7 +609,7 @@ impl<'a, 'b: 'a, 'c: 'b> NodeHolder for Node<'a, 'b, 'c> {
620609
621610impl < ' a , ' b , ' c > Drop for Node < ' a , ' b , ' c > {
622611 fn drop ( & mut self ) {
623- if !panicking ( ) {
612+ if !std :: thread :: panicking ( ) {
624613 // Check that we processed all pending events
625614 let msg_events = self . node . get_and_clear_pending_msg_events ( ) ;
626615 if !msg_events. is_empty ( ) {
0 commit comments