Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 896
1 vote

How to ensure unique u16 IDs for accounts?

//Add this to account struct and make it a universal account #[account] pub struct Counter { pub count: u16 } pub fn handler(ctx: Context<CreateUser>) -> Result<()> { let user_account = &mut ctx.accounts.user_account … Inside the account, the user account would hold a pubkey instead of an ID. This would effectively make sure each ID is unique since you are initializing the user account in this instruction. …
Varun Siva's user avatar
5 votes
Accepted

How to use realloc to increase account space in Anchor?

Keep in mind that a vector of pubkeys has a maximum length, as each account has a maximum size. … need to keep 8 bytes added to the account size, which I have already added at the beginning in the get_size() function. …
Varun Siva's user avatar