diff --git a/pkg/innerring/processors/settlement/audit/calculate.go b/pkg/innerring/processors/settlement/audit/calculate.go index fd498f59..0b5f5de6 100644 --- a/pkg/innerring/processors/settlement/audit/calculate.go +++ b/pkg/innerring/processors/settlement/audit/calculate.go @@ -82,6 +82,17 @@ func (c *Calculator) Calculate(p *CalculatePrm) { log.Debug("processing transfers") table.iterate(func(tx *transferTx) { + sign := tx.amount.Sign() + if sign == 0 { + log.Debug("ignore zero transfer") + return + } + + if sign < 0 { + tx.from, tx.to = tx.to, tx.from + tx.amount.Neg(tx.amount) + } + c.prm.Exchanger.Transfer(tx.from, tx.to, tx.amount) }) }