From 9fe833385ce995b762a4bbc7fd9ac8514610c7ac Mon Sep 17 00:00:00 2001 From: Zhang ShengYan Date: Mon, 28 Oct 2024 12:59:22 +0800 Subject: [PATCH] fix: read token_account from bumps --- content/courses/program-security/owner-checks.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/content/courses/program-security/owner-checks.md b/content/courses/program-security/owner-checks.md index 99466ac52..42f4b6343 100644 --- a/content/courses/program-security/owner-checks.md +++ b/content/courses/program-security/owner-checks.md @@ -511,10 +511,7 @@ pub mod owner_check { pub fn secure_withdraw(ctx: Context) -> Result<()> { let amount = ctx.accounts.token_account.amount; - let seeds = &[ - b"token".as_ref(), - &[*ctx.bumps.get("token_account").unwrap()], - ]; + let seeds = &[b"token".as_ref(), &[ctx.bumps.token_account]]; let signer = [&seeds[..]]; let cpi_ctx = CpiContext::new_with_signer(