Skip to content

Commit

Permalink
fix: don't graylist if top up failed (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk authored Nov 15, 2024
1 parent fec30ac commit 09c0e19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src-server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ app.post('/account/:recipient_address', async (req, res) => {
res.send({ message });
return;
}
grayList.set(address, new Date(Date.now() + 1000 * 60 * 60 * 4));

previousSpendPromise = (previousSpendPromise ?? Promise.resolve()).catch(fetchNonce).then(() =>
aeSdk.spend(toAettos(TOPUP_AMOUNT), address, {
Expand All @@ -106,6 +105,7 @@ app.post('/account/:recipient_address', async (req, res) => {
}),
);
const tx = await previousSpendPromise;
grayList.set(address, new Date(Date.now() + 1000 * 60 * 60 * 4));
console.info(`Top up ${address} with ${TOPUP_AMOUNT} ${currency.symbol}, tx hash ${tx.hash}`);
const balance = await aeSdk.getBalance(address);
res.send({ tx_hash: tx.hash, balance });
Expand Down

0 comments on commit 09c0e19

Please sign in to comment.