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