Fix/Do not process empty basic incomes #152

Merged
fyrchik merged 1 commit from carpawell/frostfs-node:fix/do-not-process-zero-basic-incomes into master 2023-03-21 06:59:34 +00:00
3 changed files with 11 additions and 0 deletions
Showing only changes of commit cda04dc33c - Show all commits

View file

@ -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",

View file

@ -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

View file

@ -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)