Fix/Do not process empty basic incomes #152
3 changed files with 11 additions and 0 deletions
|
@ -26,6 +26,11 @@ func (inc *IncomeSettlementContext) Collect() {
|
|||
return
|
||||
}
|
||||
|
||||
if cachedRate == 0 {
|
||||
inc.noop = true
|
||||
return
|
||||
}
|
||||
|
||||
cnrEstimations, err := inc.estimations.Estimations(inc.epoch)
|
||||
if err != nil {
|
||||
inc.log.Error("can't fetch container size estimations",
|
||||
|
|
|
@ -28,6 +28,8 @@ type (
|
|||
IncomeSettlementContext struct {
|
||||
mu sync.Mutex // lock to prevent collection and distribution in the same time
|
||||
|
||||
noop bool
|
||||
|
||||
log *logger.Logger
|
||||
epoch uint64
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ func (inc *IncomeSettlementContext) Distribute() {
|
|||
inc.mu.Lock()
|
||||
defer inc.mu.Unlock()
|
||||
|
||||
if inc.noop {
|
||||
return
|
||||
}
|
||||
|
||||
txTable := common.NewTransferTable()
|
||||
|
||||
bankBalance, err := inc.balances.Balance(inc.bankOwner)
|
||||
|
|
Loading…
Reference in a new issue