1

if I have an instruction that invokes another instruction that succeeds but the instruction that invoked it later fails, are there balance changes.

transfer_sol_instruction() -> ProgramResult
{
 

invoke(&system_instruction(from_pubkey, to_pubkey, 2000),  [from_pubkey.clone(), to_pubkey.clone()]?;
// invoke was successful
Err(SomeCustomError::instruction_not_completed().into())

}

I have tried on testing on both local-validator and devnet, but it seems the transaction never gets included as there are no outputs in my solana-logs and I do not see anything in the explorer but I do remember seeing some failed transactions on Mainnet in the explorer.

2 Answers 2

1

As you have noted the transaction never gets included, so there will be no balance changes.

The reason for this is that in the solana runtime if any part of a transaction fails or raises an error, the entire transaction fails. This equally applies if you have atomic instructions in the same transaction and one or more of them fails, the entire transaction will fail.

2
  • thank you for this, does this mean mainnet includes failed transactions in the explorer while devnet does not include them in the explorer Jul 25, 2022 at 16:16
  • Failed transactions should appear in both mainnet and devnet explorers. A cursory look at transactions interacting with the system program account reveals a number of failed transactions explorer.solana.com/address/…
    – Henry E
    Jul 25, 2022 at 16:20
2

Most likely your transaction is failing in simulation, so never actually gets broadcast to the cluster and cannot be included in a block, which must happen for it to show up on the explorer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.