Make boosts mandatory (#121)

* make boosts mandatory

* make boosts mandatory

* fix account loading

* cleanup

* cleanup

* bump version

* nullify reward for invalid boosts
This commit is contained in:
Hardhat Chad
2025-03-30 08:44:42 -05:00
committed by GitHub
parent b54c542925
commit 832b3264a8
4 changed files with 42 additions and 43 deletions

View File

@@ -56,22 +56,21 @@ pub fn mine(
authority: Pubkey,
bus: Pubkey,
solution: Solution,
boost_keys: Option<[Pubkey; 2]>,
boost: Pubkey,
boost_config: Pubkey,
) -> Instruction {
let proof = proof_pda(authority).0;
let mut accounts = vec![
let accounts = vec![
AccountMeta::new(signer, true),
AccountMeta::new(bus, false),
AccountMeta::new_readonly(CONFIG_ADDRESS, false),
AccountMeta::new(proof, false),
AccountMeta::new_readonly(sysvar::instructions::ID, false),
AccountMeta::new_readonly(sysvar::slot_hashes::ID, false),
AccountMeta::new_readonly(boost, false),
AccountMeta::new(proof_pda(boost).0, false),
AccountMeta::new_readonly(boost_config, false),
];
if let Some([boost_address, boost_config_address]) = boost_keys {
accounts.push(AccountMeta::new_readonly(boost_address, false));
accounts.push(AccountMeta::new(proof_pda(boost_address).0, false));
accounts.push(AccountMeta::new_readonly(boost_config_address, false));
}
Instruction {
program_id: crate::ID,
accounts,