fix self cpi

This commit is contained in:
Hardhat Chad
2025-07-10 14:03:01 -07:00
parent b29ba4b5d1
commit 2719189b5d
9 changed files with 50 additions and 52 deletions

View File

@@ -9,7 +9,7 @@ pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes
// Load accounts.
let clock = Clock::get()?;
let [signer_info, block_info, collateral_info, mint_ore_info, recipient_info, stake_info, system_program, token_program] =
let [signer_info, block_info, collateral_info, mint_ore_info, recipient_info, stake_info, system_program, token_program, ore_program] =
accounts
else {
return Err(ProgramError::NotEnoughAccountKeys);
@@ -31,6 +31,7 @@ pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes
.assert(|t| t.owner() == *block_info.key)?;
system_program.is_program(&system_program::ID)?;
token_program.is_program(&spl_token::ID)?;
ore_program.is_program(&ore_api::ID)?;
// Check timestamp. Collateral can only be withdrawn after the block has started mining
let start_slot = stake.block_id * 1500;
@@ -59,7 +60,7 @@ pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes
// Emit event.
program_log(
stake.block_id,
block_info.clone(),
&[block_info.clone(), ore_program.clone()],
&WithdrawEvent {
disc: OreEvent::Withdraw as u64,
authority: *signer_info.key,