diff --git a/pkg/innerring/audit.go b/pkg/innerring/audit.go index f277b027..aef897e0 100644 --- a/pkg/innerring/audit.go +++ b/pkg/innerring/audit.go @@ -175,13 +175,8 @@ func (a auditSettlementDeps) Transfer(sender, recipient *owner.ID, amount *big.I return } - amount64 := amount.Int64() - if amount64 == 0 { - amount64 = 1 - } - if err := a.balanceClient.TransferX(balanceClient.TransferPrm{ - Amount: amount64, + Amount: amount.Int64(), From: sender, To: recipient, Details: transferAuditDetails, diff --git a/pkg/innerring/processors/settlement/audit/calculate.go b/pkg/innerring/processors/settlement/audit/calculate.go index 6bea9985..fd498f59 100644 --- a/pkg/innerring/processors/settlement/audit/calculate.go +++ b/pkg/innerring/processors/settlement/audit/calculate.go @@ -39,7 +39,11 @@ type singleResultCtx struct { sumSGSize *big.Int } -var bigGB = big.NewInt(1 << 30) +var ( + bigGB = big.NewInt(1 << 30) + bigZero = big.NewInt(0) + bigOne = big.NewInt(1) +) // Calculate calculates payments for audit results in a specific epoch of the network. // Wraps the results in a money transfer transaction and sends it to the network. @@ -242,6 +246,10 @@ func (c *Calculator) fillTransferTable(ctx *singleResultCtx) bool { fee := big.NewInt(0).Mul(price, ctx.sumSGSize) fee.Div(fee, bigGB) + if fee.Cmp(bigZero) == 0 { + fee.Add(fee, bigOne) + } + ctx.txTable.transfer(&transferTx{ from: cnrOwner, to: ownerID,