@@ -170,32 +170,12 @@ pub trait ParseMiningMessagesFromDownstream<
170
170
. map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
171
171
}
172
172
}
173
- Ok ( Mining :: UpdateChannel ( m) ) => match channel_type {
174
- SupportedChannelTypes :: Standard => {
175
- info ! ( "Received UpdateChannel->Standard message" ) ;
176
- self_mutex
177
- . safe_lock ( |self_| self_. handle_update_channel ( m) )
178
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
179
- }
180
- SupportedChannelTypes :: Extended => {
181
- info ! ( "Received UpdateChannel->Extended message" ) ;
182
- self_mutex
183
- . safe_lock ( |self_| self_. handle_update_channel ( m) )
184
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
185
- }
186
- SupportedChannelTypes :: Group => {
187
- info ! ( "Received UpdateChannel->Group message" ) ;
188
- self_mutex
189
- . safe_lock ( |self_| self_. handle_update_channel ( m) )
190
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
191
- }
192
- SupportedChannelTypes :: GroupAndExtended => {
193
- info ! ( "Received UpdateChannel->GroupAndExtended message" ) ;
194
- self_mutex
195
- . safe_lock ( |self_| self_. handle_update_channel ( m) )
196
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
197
- }
198
- } ,
173
+ Ok ( Mining :: UpdateChannel ( m) ) => {
174
+ info ! ( "Received UpdateChannel->Standard message" ) ;
175
+ self_mutex
176
+ . safe_lock ( |self_| self_. handle_update_channel ( m) )
177
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
178
+ }
199
179
Ok ( Mining :: SubmitSharesStandard ( m) ) => match channel_type {
200
180
SupportedChannelTypes :: Standard => {
201
181
debug ! ( "Received SubmitSharesStandard->Standard message" ) ;
@@ -385,65 +365,29 @@ pub trait ParseMiningMessagesFromUpstream<
385
365
. map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
386
366
}
387
367
}
388
-
389
368
Ok ( Mining :: OpenMiningChannelError ( m) ) => {
390
369
error ! (
391
370
"Received OpenExtendedMiningChannelError with error code {}" ,
392
371
std:: str :: from_utf8( m. error_code. as_ref( ) ) . unwrap_or( "unknown error code" )
393
372
) ;
394
- match channel_type {
395
- SupportedChannelTypes :: Standard => self_mutex
396
- . safe_lock ( |x| x. handle_open_mining_channel_error ( m) )
397
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
398
- SupportedChannelTypes :: Extended => self_mutex
399
- . safe_lock ( |x| x. handle_open_mining_channel_error ( m) )
400
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
401
- SupportedChannelTypes :: Group => self_mutex
402
- . safe_lock ( |x| x. handle_open_mining_channel_error ( m) )
403
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
404
- SupportedChannelTypes :: GroupAndExtended => self_mutex
405
- . safe_lock ( |x| x. handle_open_mining_channel_error ( m) )
406
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
407
- }
373
+ self_mutex
374
+ . safe_lock ( |x| x. handle_open_mining_channel_error ( m) )
375
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
408
376
}
409
-
410
377
Ok ( Mining :: UpdateChannelError ( m) ) => {
411
378
error ! (
412
379
"Received UpdateChannelError with error code {}" ,
413
380
std:: str :: from_utf8( m. error_code. as_ref( ) ) . unwrap_or( "unknown error code" )
414
381
) ;
415
- match channel_type {
416
- SupportedChannelTypes :: Standard => self_mutex
417
- . safe_lock ( |x| x. handle_update_channel_error ( m) )
418
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
419
- SupportedChannelTypes :: Extended => self_mutex
420
- . safe_lock ( |x| x. handle_update_channel_error ( m) )
421
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
422
- SupportedChannelTypes :: Group => self_mutex
423
- . safe_lock ( |x| x. handle_update_channel_error ( m) )
424
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
425
- SupportedChannelTypes :: GroupAndExtended => self_mutex
426
- . safe_lock ( |x| x. handle_update_channel_error ( m) )
427
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
428
- }
382
+ self_mutex
383
+ . safe_lock ( |x| x. handle_update_channel_error ( m) )
384
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
429
385
}
430
-
431
386
Ok ( Mining :: CloseChannel ( m) ) => {
432
387
info ! ( "Received CloseChannel for channel id: {}" , m. channel_id) ;
433
- match channel_type {
434
- SupportedChannelTypes :: Standard => self_mutex
435
- . safe_lock ( |x| x. handle_close_channel ( m) )
436
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
437
- SupportedChannelTypes :: Extended => self_mutex
438
- . safe_lock ( |x| x. handle_close_channel ( m) )
439
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
440
- SupportedChannelTypes :: Group => self_mutex
441
- . safe_lock ( |x| x. handle_close_channel ( m) )
442
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
443
- SupportedChannelTypes :: GroupAndExtended => self_mutex
444
- . safe_lock ( |x| x. handle_close_channel ( m) )
445
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
446
- }
388
+ self_mutex
389
+ . safe_lock ( |x| x. handle_close_channel ( m) )
390
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
447
391
}
448
392
449
393
Ok ( Mining :: SetExtranoncePrefix ( m) ) => {
@@ -452,60 +396,26 @@ pub trait ParseMiningMessagesFromUpstream<
452
396
m. channel_id
453
397
) ;
454
398
debug ! ( "SetExtranoncePrefix: {:?}" , m) ;
455
- match channel_type {
456
- SupportedChannelTypes :: Standard => self_mutex
457
- . safe_lock ( |x| x. handle_set_extranonce_prefix ( m) )
458
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
459
- SupportedChannelTypes :: Extended => self_mutex
460
- . safe_lock ( |x| x. handle_set_extranonce_prefix ( m) )
461
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
462
- SupportedChannelTypes :: Group => self_mutex
463
- . safe_lock ( |x| x. handle_set_extranonce_prefix ( m) )
464
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
465
- SupportedChannelTypes :: GroupAndExtended => self_mutex
466
- . safe_lock ( |x| x. handle_set_extranonce_prefix ( m) )
467
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
468
- }
399
+ self_mutex
400
+ . safe_lock ( |x| x. handle_set_extranonce_prefix ( m) )
401
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
469
402
}
470
403
Ok ( Mining :: SubmitSharesSuccess ( m) ) => {
471
404
debug ! ( "Received SubmitSharesSuccess" ) ;
472
405
trace ! ( "SubmitSharesSuccess: {:?}" , m) ;
473
- match channel_type {
474
- SupportedChannelTypes :: Standard => self_mutex
475
- . safe_lock ( |x| x. handle_submit_shares_success ( m) )
476
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
477
- SupportedChannelTypes :: Extended => self_mutex
478
- . safe_lock ( |x| x. handle_submit_shares_success ( m) )
479
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
480
- SupportedChannelTypes :: Group => self_mutex
481
- . safe_lock ( |x| x. handle_submit_shares_success ( m) )
482
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
483
- SupportedChannelTypes :: GroupAndExtended => self_mutex
484
- . safe_lock ( |x| x. handle_submit_shares_success ( m) )
485
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
486
- }
406
+ self_mutex
407
+ . safe_lock ( |x| x. handle_submit_shares_success ( m) )
408
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
487
409
}
488
410
Ok ( Mining :: SubmitSharesError ( m) ) => {
489
411
error ! (
490
412
"Received SubmitSharesError with error code {}" ,
491
413
std:: str :: from_utf8( m. error_code. as_ref( ) ) . unwrap_or( "unknown error code" )
492
414
) ;
493
- match channel_type {
494
- SupportedChannelTypes :: Standard => self_mutex
495
- . safe_lock ( |x| x. handle_submit_shares_error ( m) )
496
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
497
- SupportedChannelTypes :: Extended => self_mutex
498
- . safe_lock ( |x| x. handle_submit_shares_error ( m) )
499
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
500
- SupportedChannelTypes :: Group => self_mutex
501
- . safe_lock ( |x| x. handle_submit_shares_error ( m) )
502
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
503
- SupportedChannelTypes :: GroupAndExtended => self_mutex
504
- . safe_lock ( |x| x. handle_submit_shares_error ( m) )
505
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
506
- }
415
+ self_mutex
416
+ . safe_lock ( |x| x. handle_submit_shares_error ( m) )
417
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
507
418
}
508
-
509
419
Ok ( Mining :: NewMiningJob ( m) ) => {
510
420
info ! (
511
421
"Received new mining job for channel id: {} with job id: {} is future: {}" ,
@@ -553,22 +463,10 @@ pub trait ParseMiningMessagesFromUpstream<
553
463
m. channel_id, m. job_id
554
464
) ;
555
465
debug ! ( "SetNewPrevHash: {:?}" , m) ;
556
- match channel_type {
557
- SupportedChannelTypes :: Standard => self_mutex
558
- . safe_lock ( |x| x. handle_set_new_prev_hash ( m) )
559
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
560
- SupportedChannelTypes :: Extended => self_mutex
561
- . safe_lock ( |x| x. handle_set_new_prev_hash ( m) )
562
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
563
- SupportedChannelTypes :: Group => self_mutex
564
- . safe_lock ( |x| x. handle_set_new_prev_hash ( m) )
565
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
566
- SupportedChannelTypes :: GroupAndExtended => self_mutex
567
- . safe_lock ( |x| x. handle_set_new_prev_hash ( m) )
568
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
569
- }
466
+ self_mutex
467
+ . safe_lock ( |x| x. handle_set_new_prev_hash ( m) )
468
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
570
469
}
571
-
572
470
Ok ( Mining :: SetCustomMiningJobSuccess ( m) ) => {
573
471
info ! (
574
472
"Received SetCustomMiningJobSuccess for channel id: {} for job id: {}" ,
@@ -611,20 +509,9 @@ pub trait ParseMiningMessagesFromUpstream<
611
509
Ok ( Mining :: SetTarget ( m) ) => {
612
510
info ! ( "Received SetTarget for channel id: {}" , m. channel_id) ;
613
511
debug ! ( "SetTarget: {:?}" , m) ;
614
- match channel_type {
615
- SupportedChannelTypes :: Standard => self_mutex
616
- . safe_lock ( |x| x. handle_set_target ( m) )
617
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
618
- SupportedChannelTypes :: Extended => self_mutex
619
- . safe_lock ( |x| x. handle_set_target ( m) )
620
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
621
- SupportedChannelTypes :: Group => self_mutex
622
- . safe_lock ( |x| x. handle_set_target ( m) )
623
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
624
- SupportedChannelTypes :: GroupAndExtended => self_mutex
625
- . safe_lock ( |x| x. handle_set_target ( m) )
626
- . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?,
627
- }
512
+ self_mutex
513
+ . safe_lock ( |x| x. handle_set_target ( m) )
514
+ . map_err ( |e| crate :: Error :: PoisonLock ( e. to_string ( ) ) ) ?
628
515
}
629
516
Ok ( Mining :: SetGroupChannel ( m) ) => {
630
517
info ! ( "Received SetGroupChannel" ) ;
0 commit comments