diff --git a/programs/network/src/jobs/process_unstakes/unstake_preprocess.rs b/programs/network/src/jobs/process_unstakes/unstake_preprocess.rs index 0725ad3e..2b302d0c 100644 --- a/programs/network/src/jobs/process_unstakes/unstake_preprocess.rs +++ b/programs/network/src/jobs/process_unstakes/unstake_preprocess.rs @@ -24,7 +24,8 @@ pub struct UnstakePreprocess<'info> { pub fn handler(ctx: Context) -> Result { // Get accounts. - let config = &ctx.accounts.config; + let config_key = ctx.accounts.config.key(); + let config = &ctx.accounts.config.load()?; let registry = &ctx.accounts.registry; let thread = &ctx.accounts.thread; let unstake = &ctx.accounts.unstake; @@ -38,19 +39,16 @@ pub fn handler(ctx: Context) -> Result { authority: unstake.authority, authority_tokens: get_associated_token_address( &unstake.authority, - &config.load()?.mint, + &config.mint, ), - config: config.key(), + config: config_key, delegation: unstake.delegation, registry: registry.key(), thread: thread.key(), token_program: anchor_spl::token::ID, unstake: unstake.key(), worker: unstake.worker, - worker_tokens: get_associated_token_address( - &unstake.worker, - &config.load()?.mint, - ), + worker_tokens: get_associated_token_address(&unstake.worker, &config.mint), } .to_account_metas(Some(true)), data: crate::instruction::UnstakeProcess {}.data(), diff --git a/programs/network/src/jobs/take_snapshot/create_entry.rs b/programs/network/src/jobs/take_snapshot/create_entry.rs index 978a8a0f..191ae5b7 100644 --- a/programs/network/src/jobs/take_snapshot/create_entry.rs +++ b/programs/network/src/jobs/take_snapshot/create_entry.rs @@ -71,6 +71,7 @@ pub struct TakeSnapshotCreateEntry<'info> { pub fn handler(ctx: Context) -> Result { // Get accounts. + let config_key = ctx.accounts.config.key(); let config = &ctx.accounts.config.load()?; let delegation = &ctx.accounts.delegation; let registry = &ctx.accounts.registry; @@ -102,7 +103,7 @@ pub fn handler(ctx: Context) -> Result Instruction { program_id: crate::ID, accounts: crate::accounts::TakeSnapshotCreateEntry { - config: ctx.accounts.config.key(), + config: config_key, delegation: next_delegation_pubkey, payer: PAYER_PUBKEY, registry: registry.key(), @@ -127,7 +128,7 @@ pub fn handler(ctx: Context) -> Result Instruction { program_id: crate::ID, accounts: crate::accounts::TakeSnapshotCreateFrame { - config: ctx.accounts.config.key(), + config: config_key, payer: PAYER_PUBKEY, registry: registry.key(), snapshot: snapshot.key(),