Skip to content

Commit 57bdb09

Browse files
authored
Fix program account not being passed to CPI (#316)
* Fix program account not being passed to CPI * Fix transaction sending
1 parent c4238c7 commit 57bdb09

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pythnet/remote-executor/cli/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![deny(warnings)]
22
pub mod cli;
3-
43
use std::str::FromStr;
54

65
use anchor_client::{
@@ -318,6 +317,13 @@ pub fn get_execute_instruction(
318317

319318
// Add the rest of `remaining_accounts` from the payload
320319
for instruction in executor_payload.instructions {
320+
// Push program_id
321+
account_metas.push(AccountMeta {
322+
pubkey: instruction.program_id,
323+
is_signer: false,
324+
is_writable: false,
325+
});
326+
// Push other accounts
321327
for account_meta in Instruction::from(&instruction).accounts {
322328
if account_meta.pubkey != executor_key {
323329
account_metas.push(account_meta.clone());

pythnet/remote-executor/programs/remote-executor/src/tests/executor_simulator.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ impl ExecutorSimulator {
340340

341341
// Add the rest of `remaining_accounts` from parsing the payload
342342
for instruction in executor_payload.instructions {
343+
// Push program_id
344+
account_metas.push(AccountMeta {
345+
pubkey: instruction.program_id,
346+
is_signer: false,
347+
is_writable: false,
348+
});
349+
// Push other accounts
343350
for account_meta in Instruction::from(&instruction).accounts {
344351
if account_meta.pubkey != executor_key {
345352
account_metas.push(account_meta.clone());

0 commit comments

Comments
 (0)