From e17baf384b4667fc777ef9ffb80132e3cacad0ab Mon Sep 17 00:00:00 2001 From: Christophe Vidal <1253866+0cv@users.noreply.github.com> Date: Sat, 23 Apr 2022 12:16:53 +0200 Subject: [PATCH] Update processor.rs to fix `sum of account balances before and after instruction do not match`. Indeed, `lamport_streamed_to_receiver` added to the receiver must be substracted from the escrow before the remaining lamports from the escrow are sent to the sender. --- src/processor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/processor.rs b/src/processor.rs index d2989b2..1d594b2 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -147,6 +147,7 @@ impl Processor { } **receiver_account.try_borrow_mut_lamports()? += lamport_streamed_to_receiver; + **escrow_account.try_borrow_mut_lamports()? -= lamport_streamed_to_receiver; escrow_data.lamports_withdrawn += lamport_streamed_to_receiver; **sender_account.try_borrow_mut_lamports()? += **escrow_account.lamports.borrow();