Move account related verification out of API handler
Change-Id: Ice70ab8bfcf4018693f90cb5e47bea6cb9e46309
This commit is contained in:
parent
aab930bfab
commit
679fa92a56
|
@ -45,14 +45,7 @@ pub fn verify_signatures(
|
||||||
initial_creation: bool,
|
initial_creation: bool,
|
||||||
) -> ProgramResult {
|
) -> ProgramResult {
|
||||||
let sig_infos = filter_empty_signatures(&signers);
|
let sig_infos = filter_empty_signatures(&signers);
|
||||||
|
|
||||||
// We check this manually because the type-level checks are
|
|
||||||
// not available for Instructions yet. See the VerifySig
|
|
||||||
// struct for more info.
|
|
||||||
let ix_acc = &ctx.accounts.instruction_sysvar;
|
let ix_acc = &ctx.accounts.instruction_sysvar;
|
||||||
if *ix_acc.key != solana_program::sysvar::instructions::id() {
|
|
||||||
return Err(ProgramError::Custom(42));
|
|
||||||
}
|
|
||||||
|
|
||||||
let current_ix_idx =
|
let current_ix_idx =
|
||||||
solana_program::sysvar::instructions::load_current_index(&ix_acc.try_borrow_data()?);
|
solana_program::sysvar::instructions::load_current_index(&ix_acc.try_borrow_data()?);
|
||||||
|
|
|
@ -128,6 +128,12 @@ pub mod anchor_bridge {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify_signatures(&mut self, ctx: Context<VerifySig>, data: VerifySigsData) -> ProgramResult {
|
pub fn verify_signatures(&mut self, ctx: Context<VerifySig>, data: VerifySigsData) -> ProgramResult {
|
||||||
|
// We check this manually because the type-level checks are not available for
|
||||||
|
// Instructions yet. See the VerifySig struct for more info.
|
||||||
|
if *ctx.accounts.instruction_sysvar.key != solana_program::sysvar::instructions::id() {
|
||||||
|
return Err(ProgramError::Custom(42));
|
||||||
|
}
|
||||||
|
|
||||||
api::verify_signatures(
|
api::verify_signatures(
|
||||||
self,
|
self,
|
||||||
ctx,
|
ctx,
|
||||||
|
|
Loading…
Reference in New Issue