Skip to content

Commit

Permalink
include price if sp in maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Aug 14, 2023
1 parent 9f64595 commit 0be796d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion e2e/tests/sp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (s *StorageProviderTestSuite) CheckGlobalSpStorePrice() {
storePrices := make([]sdk.Dec, 0)
readPrices := make([]sdk.Dec, 0)
for _, sp := range sps.Sps {
if sp.Status == sptypes.STATUS_IN_SERVICE {
if sp.Status == sptypes.STATUS_IN_SERVICE || sp.Status == sptypes.STATUS_IN_MAINTENANCE {
spStoragePrice, err := s.Client.QuerySpStoragePrice(ctx, &sptypes.QuerySpStoragePriceRequest{
SpAddr: sp.OperatorAddress,
})
Expand Down
15 changes: 7 additions & 8 deletions x/sp/keeper/sp_storage_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,14 @@ func (k Keeper) UpdateGlobalSpStorePrice(ctx sdk.Context) error {
storePrices := make([]sdk.Dec, 0)
readPrices := make([]sdk.Dec, 0)
for _, sp := range sps {
if sp.Status != types.STATUS_IN_SERVICE {
continue
if sp.Status == types.STATUS_IN_SERVICE || sp.Status == types.STATUS_IN_MAINTENANCE {
price, found := k.GetSpStoragePrice(ctx, sp.Id)
if !found {
return fmt.Errorf("cannot find price for storage provider %d", sp.Id)
}
storePrices = append(storePrices, price.StorePrice)
readPrices = append(readPrices, price.ReadPrice)
}
price, found := k.GetSpStoragePrice(ctx, sp.Id)
if !found {
return fmt.Errorf("cannot find price for storage provider %d", sp.Id)
}
storePrices = append(storePrices, price.StorePrice)
readPrices = append(readPrices, price.ReadPrice)
}
l := len(storePrices)
if l == 0 {
Expand Down

0 comments on commit 0be796d

Please sign in to comment.