mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
miner as fee payer
This commit is contained in:
@@ -256,14 +256,13 @@ pub fn mine(signer: Pubkey, bus: Pubkey, solution: Solution) -> Instruction {
|
||||
}
|
||||
|
||||
/// Builds an open instruction.
|
||||
pub fn open(signer: Pubkey, miner: Pubkey, payer: Pubkey) -> Instruction {
|
||||
pub fn open(signer: Pubkey, miner: 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(miner, true),
|
||||
AccountMeta::new(proof_pda.0, false),
|
||||
AccountMeta::new_readonly(solana_program::system_program::id(), false),
|
||||
AccountMeta::new_readonly(sysvar::slot_hashes::id(), false),
|
||||
|
||||
@@ -10,4 +10,4 @@ pub(crate) use ore_utils as utils;
|
||||
use solana_program::declare_id;
|
||||
|
||||
// declare_id!("mineRHF5r6S7HyD9SppBfVMXMavDkJsxwGesEvxZr2A");
|
||||
declare_id!("EarRpm6FCvs7biAjL1F6yTugqUvLoXtYUvPKb2tHNh8w");
|
||||
declare_id!("6NSA5s2mk5fJctfoKxWoewFpT4uwtZpBAVd6DHyMk8Zi");
|
||||
|
||||
@@ -33,13 +33,11 @@ pub fn process_open<'a, 'info>(
|
||||
let args = OpenArgs::try_from_bytes(data)?;
|
||||
|
||||
// Load accounts
|
||||
let [signer, payer_info, miner_info, 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(payer_info)?;
|
||||
load_system_account(miner_info, false)?;
|
||||
load_signer(miner_info)?;
|
||||
load_uninitialized_pda(
|
||||
proof_info,
|
||||
&[PROOF, signer.key.as_ref()],
|
||||
@@ -56,7 +54,7 @@ pub fn process_open<'a, 'info>(
|
||||
8 + size_of::<Proof>(),
|
||||
&[PROOF, signer.key.as_ref(), &[args.bump]],
|
||||
system_program,
|
||||
payer_info,
|
||||
miner_info,
|
||||
)?;
|
||||
let clock = Clock::get().or(Err(ProgramError::InvalidAccountData))?;
|
||||
let mut proof_data = proof_info.data.borrow_mut();
|
||||
|
||||
Reference in New Issue
Block a user