storagenode/payout: fix disk space value at payout

Payout is still calculating using the tb*h. 0So it’s getting the total disk space used this month and dividing by (24*30) instead of just 30.

More context here: https://forum.storj.io/t/current-month-earnings-in-node-v1-67-1/20319/5

Follow up PR for https://github.com/storj/storj/issues/5146

Change-Id: Ie2d48497f2a9bdbc995c99ee27e70b46580ff638
This commit is contained in:
Clement Sam 2022-11-17 13:31:29 +00:00 committed by Storj Robot
parent 9fb18a43d8
commit 3e0a4230a5
2 changed files with 4 additions and 3 deletions

View File

@ -150,8 +150,8 @@ func (s *Service) estimationUsagePeriod(ctx context.Context, period time.Time, j
for j := 0; j < len(storageDaily); j++ {
payout.DiskSpace += storageDaily[j].AtRestTotal
}
// dividing by 720 to show tbm instead of tbh.
payout.DiskSpace /= 720
// dividing by 30 to show tbm instead of tb.
payout.DiskSpace /= 30
payout.SetDiskSpacePayout(priceModel.DiskSpace)
payout.SetHeldAmount()
payout.SetPayout()

View File

@ -31,7 +31,8 @@ type DB interface {
// Stamp is storage usage stamp for satellite from interval start till next interval.
type Stamp struct {
SatelliteID storj.NodeID `json:"-"`
AtRestTotal float64 `json:"atRestTotal"`
// AtRestTotal is the disk space used from IntervalStart to IntervalEndTime in Bytes*day
AtRestTotal float64 `json:"atRestTotal"`
// IntervalStart represents one tally day
// TODO: rename to timestamp to match DB
IntervalStart time.Time `json:"intervalStart"`