Skip to content

Commit

Permalink
Fix typo in code reference: missing an other '='. (#398)
Browse files Browse the repository at this point in the history
This commit corrects a typo in a code reference where a single '=' was  used instead of '==':

`require!(cash_account.owner = ctx.accounts.signer, ErrorCode::InvalidSigner);`

Contrary to the actual code implementation:

`require!(cash_account.owner == ctx.accounts.signer.key(), ErrorCode::InvalidSigner);`

This fix ensures the example or documentation accurately reflects the intended comparison logic, avoiding confusion for developers referencing this code.
  • Loading branch information
josefbruseke authored Sep 4, 2024
1 parent f974d12 commit 8b4865e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/guides/dapps/cash-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Since we are directly manipulating the lamports in an account, we want to ensure
that the signer of the instruction is the same as the owner of the account so
that only the owner can call this instruction. This is why the following
validation check was implemented:
`require!(cash_account.owner = ctx.accounts.signer, ErrorCode::InvalidSigner)`.
`require!(cash_account.owner == ctx.accounts.signer, ErrorCode::InvalidSigner)`.

For error handling. the `#[error_code]` Anchor macro is used, which generates
`Error` and `type Result<T> = Result<T, Error> ` types to be used as return
Expand Down

0 comments on commit 8b4865e

Please sign in to comment.