File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
programs/portal/src/instructions Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -524,11 +524,14 @@ pub fn deregister_transceiver(ctx: Context<DeregisterTransceiver>) -> Result<()>
524524 . enabled_transceivers
525525 . set ( ctx. accounts . registered_transceiver . id , false ) ?;
526526
527- // decrement threshold if too high
528527 let num_enabled_transceivers = ctx. accounts . config . enabled_transceivers . len ( ) ;
528+ // at least one transceiver should be enabled
529+ if num_enabled_transceivers == 0 {
530+ return Err ( NTTError :: ZeroThreshold . into ( ) ) ;
531+ }
532+ // decrement threshold if too high
529533 if num_enabled_transceivers < ctx. accounts . config . threshold {
530- // threshold should be at least 1
531- ctx. accounts . config . threshold = num_enabled_transceivers. max ( 1 ) ;
534+ ctx. accounts . config . threshold = num_enabled_transceivers;
532535 }
533536 Ok ( ( ) )
534537}
You can’t perform that action at this time.
0 commit comments