3

Let's say you have an AccountInfo and want to check how much space has been allocated to the account. What is the best way of doing this?

Note, that this doesn't mean checking how many non-zero bytes have already been written to the account. This is about checking the current maximum space capacity of an account.

3
  • are you insinuating that account_info.{try_,}data_len() is insufficient in some way?
    – trent.sol
    Commented Aug 2, 2022 at 16:57
  • Not at all, the question was to elicit that answer since it's not super clear if data_len is the non zero bytes or the full space
    – Henry E
    Commented Aug 2, 2022 at 18:37
  • ah. damn kids and your high-level languages ;)
    – trent.sol
    Commented Aug 2, 2022 at 18:47

1 Answer 1

1

According to trent the answer is account_info.data_len(). This will give the amount of space that's been allocated to an account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.