File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
solana/programs/example-native-token-transfers/src/instructions/admin Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,14 @@ pub fn deregister_transceiver(ctx: Context<DeregisterTransceiver>) -> Result<()>
166166 . enabled_transceivers
167167 . set ( ctx. accounts . registered_transceiver . id , false ) ?;
168168
169- // decrement threshold if too high
170169 let num_enabled_transceivers = ctx. accounts . config . enabled_transceivers . len ( ) ;
170+ // at least one transceiver should be enabled
171+ if num_enabled_transceivers == 0 {
172+ return Err ( NTTError :: ZeroThreshold . into ( ) ) ;
173+ }
174+ // decrement threshold if too high
171175 if num_enabled_transceivers < ctx. accounts . config . threshold {
172- // threshold should be at least 1
173- ctx. accounts . config . threshold = num_enabled_transceivers. max ( 1 ) ;
176+ ctx. accounts . config . threshold = num_enabled_transceivers;
174177 }
175178 Ok ( ( ) )
176179}
You can’t perform that action at this time.
0 commit comments