continue migration

This commit is contained in:
Hardhat Chad
2024-09-27 00:22:32 +00:00
parent 609349a5aa
commit be20034e57
20 changed files with 175 additions and 363 deletions

View File

@@ -1,4 +1,4 @@
use ore_api::{loaders::*, state::Proof};
use ore_api::state::Proof;
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
};
@@ -7,16 +7,15 @@ use steel::*;
/// Update changes the miner authority on a proof account.
pub fn process_update(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
// Load accounts.
let [signer, miner_info, proof_info] = accounts else {
let [signer_info, miner_info, proof_info] = accounts else {
return Err(ProgramError::NotEnoughAccountKeys);
};
signer.is_signer()?;
// load_any(miner_info, false)?;
load_proof(proof_info, signer.key, true)?;
signer_info.is_signer()?;
let proof = proof_info
.to_account_mut::<Proof>(&ore_api::ID)?
.check_mut(|p| p.authority == *signer_info.key)?;
// Update the proof's miner authority.
let mut proof_data = proof_info.data.borrow_mut();
let proof = Proof::try_from_bytes_mut(&mut proof_data)?;
proof.miner = *miner_info.key;
Ok(())