@@ -34,7 +34,7 @@ use crate::util::test_channel_signer::TestChannelSigner;
34
34
#[ cfg( test) ]
35
35
use crate :: util:: test_channel_signer:: SignerOp ;
36
36
use crate :: util:: test_utils;
37
- use crate :: util:: test_utils:: { panicking , TestChainMonitor , TestScorer , TestKeysInterface } ;
37
+ use crate :: util:: test_utils:: { TestChainMonitor , TestScorer , TestKeysInterface } ;
38
38
use crate :: util:: ser:: { ReadableArgs , Writeable } ;
39
39
40
40
use bitcoin:: amount:: Amount ;
@@ -194,28 +194,23 @@ impl ConnectStyle {
194
194
}
195
195
196
196
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
219
214
}
220
215
}
221
216
@@ -270,9 +265,7 @@ fn do_connect_block_with_consistency_checks<'a, 'b, 'c, 'd>(node: &'a Node<'b, '
270
265
271
266
fn do_connect_block_without_consistency_checks < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , block : Block , skip_intermediaries : bool ) {
272
267
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( ) ) ;
276
269
// Update the block internally before handing it over to LDK, to ensure our assertions regarding
277
270
// transaction broadcast are correct.
278
271
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
340
333
341
334
pub fn disconnect_blocks < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , count : u32 ) {
342
335
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( ) ) ;
346
337
for i in 0 ..count {
347
338
let orig = node. blocks . lock ( ) . unwrap ( ) . pop ( ) . unwrap ( ) ;
348
339
assert ! ( orig. 1 > 0 ) ; // Cannot disconnect genesis
@@ -471,9 +462,7 @@ impl<'a, 'b, 'c> Node<'a, 'b, 'c> {
471
462
}
472
463
}
473
464
474
- #[ cfg( feature = "std" ) ]
475
465
impl < ' a , ' b , ' c > std:: panic:: UnwindSafe for Node < ' a , ' b , ' c > { }
476
- #[ cfg( feature = "std" ) ]
477
466
impl < ' a , ' b , ' c > std:: panic:: RefUnwindSafe for Node < ' a , ' b , ' c > { }
478
467
impl < ' a , ' b , ' c > Node < ' a , ' b , ' c > {
479
468
pub fn best_block_hash ( & self ) -> BlockHash {
@@ -620,7 +609,7 @@ impl<'a, 'b: 'a, 'c: 'b> NodeHolder for Node<'a, 'b, 'c> {
620
609
621
610
impl < ' a , ' b , ' c > Drop for Node < ' a , ' b , ' c > {
622
611
fn drop ( & mut self ) {
623
- if !panicking ( ) {
612
+ if !std :: thread :: panicking ( ) {
624
613
// Check that we processed all pending events
625
614
let msg_events = self . node . get_and_clear_pending_msg_events ( ) ;
626
615
if !msg_events. is_empty ( ) {
0 commit comments