-
Notifications
You must be signed in to change notification settings - Fork 78
Labels
solanaChange to Solana programsChange to Solana programs
Description
native-token-transfers/solana/programs/example-native-token-transfers/src/instructions/admin/mod.rs
Lines 163 to 176 in e06ef71
pub fn deregister_transceiver(ctx: Context<DeregisterTransceiver>) -> Result<()> { | |
ctx.accounts | |
.config | |
.enabled_transceivers | |
.set(ctx.accounts.registered_transceiver.id, false)?; | |
// decrement threshold if too high | |
let num_enabled_transceivers = ctx.accounts.config.enabled_transceivers.len(); | |
if num_enabled_transceivers < ctx.accounts.config.threshold { | |
// threshold should be at least 1 | |
ctx.accounts.config.threshold = num_enabled_transceivers.max(1); | |
} | |
Ok(()) | |
} |
deregister_transceiver
should revert if there is only one remaining transceiver. Otherwise, an admin could accidentally remove the last one, which would disable the protocol.
Metadata
Metadata
Assignees
Labels
solanaChange to Solana programsChange to Solana programs