How can we reload the lamport balance of a Signer to compare before/after a CPI?

If we have:

pub struct SomeIX<'info> {
    pub payer: Signer<'info>,

and in our handler:

    let lamports_before = ctx.accounts.payer.lamports();
    //Some CPI where payer pays...
    let lamports_after = ctx.accounts.payer.lamports();

For Token accounts, we can simply do: ctx.accounts.some_acc.reload()?;

But Signer has no reload function.

2 Answers 2


Have you tried accessing the account_info using ctx.accounts.payer.to_account_info().lamports() and seeing if that contains the updated value?

  • It's entirely possible this doesn't work but I presume there's a reason anchor doesn't have a reload function for regular account types
    – Henry E
    Oct 13, 2022 at 19:26

The answer is actually that the lamport balance updates automatically. For example when using the system program to transfer funds, the lamport balance will be updated after the CPI.

Lamports should be borrowed as mut.

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.