Skip to content

Commit

Permalink
fix(ledger) tx reversion handles empty middle accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
CrosleyZack committed Feb 25, 2025
1 parent a929bff commit 3b32fc5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/controller/ledger/controller_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ func (ctrl *DefaultController) revertTransaction(ctx context.Context, store Stor
balances[posting.Source][posting.Asset],
big.NewInt(0).Neg(posting.Amount),
)
if _, ok := balances[posting.Destination]; ok {
// if this source is also a destination
balances[posting.Destination][posting.Asset] = balances[posting.Destination][posting.Asset].Add(
balances[posting.Destination][posting.Asset],
posting.Amount,
)
}
}

for account, forAccount := range balances {
Expand Down

0 comments on commit 3b32fc5

Please sign in to comment.