Skip to content

Commit

Permalink
Update pin settings (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl authored Aug 17, 2024
2 parents 8a7fcde + 6a65255 commit 0513d7c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
1 change: 0 additions & 1 deletion api/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ type (
// pinned.
GougingSettingsPins struct {
MaxDownload Pin `json:"maxDownload"`
MaxRPCPrice Pin `json:"maxRPCPrice"`
MaxStorage Pin `json:"maxStorage"`
MaxUpload Pin `json:"maxUpload"`
}
Expand Down
12 changes: 0 additions & 12 deletions internal/bus/pinmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,6 @@ func (pm *pinManager) updateGougingSettings(ctx context.Context, pins api.Gougin
}
}

// update max RPC price
if pins.MaxRPCPrice.IsPinned() {
update, err := convertCurrencyToSC(decimal.NewFromFloat(pins.MaxRPCPrice.Value), rate)
if err != nil {
pm.logger.Warnw("failed to convert max RPC price to currency", zap.Error(err))
} else if !gs.MaxRPCPrice.Equals(update) {
pm.logger.Infow("updating max RPC price", "old", gs.MaxRPCPrice, "new", update, "rate", rate)
gs.MaxRPCPrice = update
updated = true
}
}

// update max storage price
if pins.MaxStorage.IsPinned() {
maxStorageCurr, err := convertCurrencyToSC(decimal.NewFromFloat(pins.MaxStorage.Value), rate)
Expand Down
3 changes: 0 additions & 3 deletions internal/bus/pinmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ func TestPinManager(t *testing.T) {

// configure all pins but disable them for now
pps.GougingSettingsPins.MaxDownload = api.Pin{Value: 3, Pinned: false}
pps.GougingSettingsPins.MaxRPCPrice = api.Pin{Value: 3, Pinned: false}
pps.GougingSettingsPins.MaxStorage = api.Pin{Value: 3, Pinned: false}
pps.GougingSettingsPins.MaxUpload = api.Pin{Value: 3, Pinned: false}
ms.updatPinnedSettings(pps)
Expand All @@ -260,14 +259,12 @@ func TestPinManager(t *testing.T) {

// enable the rest of the pins
pps.GougingSettingsPins.MaxDownload.Pinned = true
pps.GougingSettingsPins.MaxRPCPrice.Pinned = true
pps.GougingSettingsPins.MaxStorage.Pinned = true
pps.GougingSettingsPins.MaxUpload.Pinned = true
ms.updatPinnedSettings(pps)

// assert they're all updated
if gss := ms.gougingSettings(); gss.MaxDownloadPrice.Equals(gs.MaxDownloadPrice) ||
gss.MaxRPCPrice.Equals(gs.MaxRPCPrice) ||
gss.MaxStoragePrice.Equals(gs.MaxStoragePrice) ||
gss.MaxUploadPrice.Equals(gs.MaxUploadPrice) {
t.Fatalf("expected gouging settings to be updated, got %v = %v", gss, gs)
Expand Down

0 comments on commit 0513d7c

Please sign in to comment.