split miner authority

This commit is contained in:
Hardhat Chad
2024-06-27 15:49:45 +00:00
parent 410ad47662
commit 6bdc8cbca2
5 changed files with 42 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ pub fn process_mine<'a, 'info>(
load_signer(signer)?;
load_any_bus(bus_info, true)?;
load_config(config_info, false)?;
load_proof(proof_info, signer.key, true)?;
load_proof_with_miner(proof_info, signer.key, true)?;
load_sysvar(instructions_sysvar, sysvar::instructions::id())?;
load_sysvar(slot_hashes_sysvar, sysvar::slot_hashes::id())?;

View File

@@ -39,10 +39,11 @@ pub fn process_open<'a, 'info>(
let args = OpenArgs::try_from_bytes(data)?;
// Load accounts
let [signer, proof_info, system_program, slot_hashes_info] = accounts else {
let [signer, miner_info, proof_info, system_program, slot_hashes_info] = accounts else {
return Err(ProgramError::NotEnoughAccountKeys);
};
load_signer(signer)?;
load_signer(miner_info)?;
load_uninitialized_pda(
proof_info,
&[PROOF, signer.key.as_ref()],
@@ -75,6 +76,7 @@ pub fn process_open<'a, 'info>(
proof.last_hash = [0; 32];
proof.last_hash_at = clock.unix_timestamp;
proof.last_stake_at = clock.unix_timestamp;
proof.miner = *miner_info.key;
proof.total_hashes = 0;
proof.total_rewards = 0;