Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7881

Failed to reallocate account data

$
0
0

I want to create a PDA account to store data about participants' wallet addresses and their deposit amounts. I have used a PDA account to store this information. It works fine when I set the array size to 100, but I encounter an error when I try to set a larger array size. I have sufficient funds to cover the rent, but I am still facing this error when creating the PDA.

impl AllParticipants {    pub const MAX: usize = 500;    // Discriminator + Vec + (PubKey + u64) * Donators Amount    pub const SIZE: usize = 8 + 4 + (32 + 8) * AllParticipants::MAX;    pub fn binary_search<T: Ord>(        sorted_vec: &[T],        target: T,    ) -> std::result::Result<usize, anchor_lang::error::Error> {        let mut low = 0;        let mut high = sorted_vec.len();        while low < high {            let mid = (low + high) / 2;            match sorted_vec[mid].cmp(&target) {                std::cmp::Ordering::Less => low = mid + 1,                std::cmp::Ordering::Equal => return Ok(mid),                std::cmp::Ordering::Greater => high = mid,            }        }        return Err(ProgramError::Custom(99).into());    }}`**Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Failed to reallocate account data**

Viewing all articles
Browse latest Browse all 7881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>