diff --git a/programs/faucet.go b/programs/faucet.go index da6a5f9..f96c231 100644 --- a/programs/faucet.go +++ b/programs/faucet.go @@ -8,6 +8,7 @@ import ( "github.com/iotaledger/evil-tools/pkg/evilwallet" "github.com/iotaledger/evil-tools/pkg/spammer" + "github.com/iotaledger/hive.go/lo" "github.com/iotaledger/hive.go/log" "github.com/iotaledger/hive.go/runtime/workerpool" ) @@ -15,7 +16,7 @@ import ( const ( MaxPendingRequestsRunning = 20 FaucetFundsAwaitTimeout = 3 * time.Minute - SelectCheckInterval = 2 * time.Second + SelectCheckInterval = 1 * time.Second ) func faucetFundsNeededForSpamType(spamType string) bool { @@ -44,7 +45,8 @@ func RequestFaucetFunds(ctx context.Context, logger log.Logger, paramsSpammer *s } canSubmit := func() bool { - return running.Load() < MaxPendingRequestsRunning && w.UnspentOutputsLeft(evilwallet.Fresh) <= 2*minFundsDeposit + maxRequests := int32(lo.Min(totalWalletsNeeded, MaxPendingRequestsRunning)) + return running.Load() < maxRequests && w.UnspentOutputsLeft(evilwallet.Fresh) <= 2*minFundsDeposit } if paramsSpammer.Duration == spammer.InfiniteDuration {