Skip to content

Commit 4abeef6

Browse files
committed
program: relax whitelist check for init user
1 parent 6f29f40 commit 4abeef6

File tree

1 file changed

+4
-2
lines changed
  • programs/drift/src/instructions

1 file changed

+4
-2
lines changed

programs/drift/src/instructions/user.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ pub fn handle_initialize_user<'c: 'info, 'info>(
239239
)?;
240240
}
241241

242+
let authority_is_signer = ctx.accounts.authority.is_signer;
242243
#[cfg(feature = "mainnet-beta")]
243-
if ctx.accounts.authority.key() != ctx.accounts.payer.key() {
244+
if !authority_is_signer && ctx.accounts.authority.key() != ctx.accounts.payer.key() {
244245
validate!(
245246
WHITELISTED_EXTERNAL_DEPOSITORS.contains(&ctx.accounts.payer.key()),
246247
ErrorCode::DefaultError,
@@ -283,8 +284,9 @@ pub fn handle_initialize_user_stats<'c: 'info, 'info>(
283284
ErrorCode::MaxNumberOfUsers
284285
)?;
285286

287+
let authority_is_signer = ctx.accounts.authority.is_signer;
286288
#[cfg(feature = "mainnet-beta")]
287-
if ctx.accounts.authority.key() != ctx.accounts.payer.key() {
289+
if !authority_is_signer && ctx.accounts.authority.key() != ctx.accounts.payer.key() {
288290
validate!(
289291
WHITELISTED_EXTERNAL_DEPOSITORS.contains(&ctx.accounts.payer.key()),
290292
ErrorCode::DefaultError,

0 commit comments

Comments
 (0)