Skip to content

Commit bf3a4b3

Browse files
committed
chore: style
1 parent cc0c917 commit bf3a4b3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/api/routes/faucets.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export const FaucetRoutes: FastifyPluginAsync<
363363
.map(r => now - r.occurred_at)
364364
.filter(r => r <= window);
365365
if (requestsInWindow.length >= triggerCount) {
366-
logger.warn(`STX faucet rate limit hit for address ${recipientAddress}`);
366+
logger.warn(`StxFaucet rate limit hit for address ${recipientAddress}`);
367367
return await reply.status(429).send({
368368
error: 'Too many requests',
369369
success: false,
@@ -372,12 +372,12 @@ export const FaucetRoutes: FastifyPluginAsync<
372372

373373
// Start with a random key index. We will try others in order if this one fails.
374374
let keyIndex = Math.round(Math.random() * (STX_FAUCET_KEYS.length - 1));
375-
let attempts = 0;
375+
let keysAttempted = 0;
376376
let sendSuccess: { txId: string; txRaw: string } | undefined;
377377
const stxAmount = await calculateSTXFaucetAmount(STX_FAUCET_NETWORK, isStackingReq);
378378
const rpcClient = clientFromNetwork(STX_FAUCET_NETWORK);
379379
do {
380-
attempts++;
380+
keysAttempted++;
381381
const senderKey = STX_FAUCET_KEYS[keyIndex];
382382
const senderAddress = getAddressFromPrivateKey(senderKey, TransactionVersion.Testnet);
383383
logger.debug(`StxFaucet attempting faucet transaction from sender: ${senderAddress}`);
@@ -401,8 +401,8 @@ export const FaucetRoutes: FastifyPluginAsync<
401401
error.message?.includes('ConflictingNonceInMempool') ||
402402
error.message?.includes('TooMuchChaining')
403403
) {
404-
if (attempts == STX_FAUCET_KEYS.length) {
405-
logger.error(
404+
if (keysAttempted == STX_FAUCET_KEYS.length) {
405+
logger.warn(
406406
`StxFaucet attempts exhausted for all faucet keys. Last error: ${error}`
407407
);
408408
throw error;

0 commit comments

Comments
 (0)