Fix building with "no-entrypoint" feature (#558)

Without this, anchor complains about a missing lifetime on a struct
relating to Benchmark.
This commit is contained in:
Christian Kamm 2023-04-24 09:52:44 +02:00 committed by GitHub
parent 898788909e
commit fe8d1a63bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,7 @@
use anchor_lang::prelude::*;
#[derive(Accounts)]
pub struct Benchmark {}
pub struct Benchmark<'info> {
/// CHECK: unused, exists only because anchor is unhappy in no-entrypoint mode otherwise
pub dummy: UncheckedAccount<'info>,
}

View File

@ -3922,7 +3922,9 @@ impl ClientInstruction for BenchmarkInstruction {
) -> (Self::Accounts, instruction::Instruction) {
let program_id = mango_v4::id();
let instruction = Self::Instruction {};
let accounts = Self::Accounts {};
let accounts = Self::Accounts {
dummy: Pubkey::new_unique(),
};
let instruction = make_instruction(program_id, &accounts, &instruction);
(accounts, instruction)