Skip to content

Commit

Permalink
fix: rename whitelist option
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol committed Mar 14, 2024
1 parent ed425de commit e94d7f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/bee/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const (
optionNameStateStoreCacheCapacity = "statestore-cache-capacity"
optionNameTargetNeighborhood = "target-neighborhood"
optionNameNeighborhoodSuggester = "neighborhood-suggester"
optionNameWhitelistedWithdrawalAddress = "withdraw-address"
optionNameWhitelistedWithdrawalAddress = "withdrawal-addresses-whitelist"
)

// nolint:gochecknoinits
Expand Down
6 changes: 1 addition & 5 deletions pkg/api/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ func (s *Service) walletWithdrawHandler(w http.ResponseWriter, r *http.Request)
if strings.EqualFold("BZZ", *path.Coin) {
bzz = true
} else if !strings.EqualFold("NativeToken", *path.Coin) {
logger.Error(nil, "invalid coin type")
jsonhttp.BadRequest(w, "only BZZ or NativeToken options are accepted")
return
}

if !slices.Contains(s.whitelistedWithdrawalAddress, *queries.Address) {
logger.Error(nil, "provided address not whitelisted")
jsonhttp.BadRequest(w, "provided address not whitelisted")
return
}
Expand Down Expand Up @@ -123,14 +121,12 @@ func (s *Service) walletWithdrawHandler(w http.ResponseWriter, r *http.Request)

nativeToken, err := s.chainBackend.BalanceAt(r.Context(), s.ethereumAddress, nil)
if err != nil {
logger.Debug("unable to acquire balance from the chain backend", "error", err)
logger.Error(nil, "unable to acquire balance from the chain backend")
logger.Error(err, "unable to acquire balance from the chain backend")
jsonhttp.InternalServerError(w, "unable to acquire balance from the chain backend")
return
}

if queries.Amount.Cmp(nativeToken) > 0 {
logger.Error(err, "not enough balance")
jsonhttp.BadRequest(w, "not enough balance")
return
}
Expand Down

0 comments on commit e94d7f0

Please sign in to comment.