diff --git a/api/src/instruction.rs b/api/src/instruction.rs index 5d00d43..d402b69 100644 --- a/api/src/instruction.rs +++ b/api/src/instruction.rs @@ -256,12 +256,13 @@ pub fn mine(signer: Pubkey, bus: Pubkey, solution: Solution) -> Instruction { } /// Builds an open instruction. -pub fn open(signer: Pubkey, miner: Pubkey) -> Instruction { +pub fn open(signer: Pubkey, miner: Pubkey, payer: Pubkey) -> Instruction { let proof_pda = Pubkey::find_program_address(&[PROOF, signer.as_ref()], &crate::id()); Instruction { program_id: crate::id(), accounts: vec![ AccountMeta::new(signer, true), + AccountMeta::new(payer, true), AccountMeta::new_readonly(miner, false), AccountMeta::new(proof_pda.0, false), AccountMeta::new_readonly(solana_program::system_program::id(), false), diff --git a/api/src/lib.rs b/api/src/lib.rs index d03a02d..514f1e3 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -10,4 +10,4 @@ pub(crate) use ore_utils as utils; use solana_program::declare_id; // declare_id!("mineRHF5r6S7HyD9SppBfVMXMavDkJsxwGesEvxZr2A"); -declare_id!("7LARaw2QJCftkGR14QVV6NSj3MFZM9iUL4GfSKySXphJ"); +declare_id!("CWZk6C3fGbpr1UprdCGaLvnW2ogh7okEmeXaS161RxUg"); diff --git a/program/src/open.rs b/program/src/open.rs index fc6e570..4535e8c 100644 --- a/program/src/open.rs +++ b/program/src/open.rs @@ -33,10 +33,12 @@ pub fn process_open<'a, 'info>( let args = OpenArgs::try_from_bytes(data)?; // Load accounts - let [signer, miner_info, proof_info, system_program, slot_hashes_info] = accounts else { + let [signer, payer_info, miner_info, proof_info, system_program, slot_hashes_info] = accounts + else { return Err(ProgramError::NotEnoughAccountKeys); }; load_signer(signer)?; + load_signer(payer_info)?; load_system_account(miner_info, false)?; load_uninitialized_pda( proof_info, @@ -54,7 +56,7 @@ pub fn process_open<'a, 'info>( 8 + size_of::(), &[PROOF, signer.key.as_ref(), &[args.bump]], system_program, - signer, + payer_info, )?; let clock = Clock::get().or(Err(ProgramError::InvalidAccountData))?; let mut proof_data = proof_info.data.borrow_mut();