[#152] IR: Process empty basic incomes

If network is not configured for basic income earnings, do not distribute
GAS by the Alphabet nodes.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
Pavel Karpy 2023-03-20 20:36:07 +03:00 committed by Gitea
parent 44b86bac5a
commit 9cd8f7cea0
3 changed files with 11 additions and 0 deletions

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)