Skip to content

Commit 46023d5

Browse files
authored
Cancel + Retry Tx Fixed (#311)
* fixed cancel & retrying with 1.2x gas values * multiplying retryTx gas values 2x
1 parent c1a24e3 commit 46023d5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/server/utils/transaction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const cancelTransactionAndUpdate = async ({
8787
data: "0x",
8888
value: "0x00",
8989
nonce: txData.nonce!,
90+
...gasOverrides,
9091
maxFeePerGas: BigNumber.from(gasOverrides.maxFeePerGas).mul(2),
9192
maxPriorityFeePerGas: BigNumber.from(
9293
gasOverrides.maxPriorityFeePerGas,

src/worker/tasks/retryTx.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getDefaultGasOverrides } from "@thirdweb-dev/sdk";
22
import { ethers } from "ethers";
3-
import { BigNumber } from "ethers/lib/ethers";
43
import { prisma } from "../../db/client";
54
import { getConfiguration } from "../../db/configuration/getConfiguration";
65
import { getTxToRetry } from "../../db/transactions/getTxToRetry";
@@ -45,10 +44,6 @@ export const retryTx = async () => {
4544

4645
// TODO: We should still retry anyway
4746
const gasOverrides = await getDefaultGasOverrides(sdk.getProvider());
48-
if (gasOverrides.maxFeePerGas?.lte(BigNumber.from(tx.maxFeePerGas))) {
49-
// If the current blockchain gas fees are lower than the transaction, wait
50-
return;
51-
}
5247

5348
if (tx.retryGasValues) {
5449
// If a retry has been triggered manually
@@ -77,6 +72,9 @@ export const retryTx = async () => {
7772
nonce: tx.nonce!,
7873
value: tx.value!,
7974
...gasOverrides,
75+
gasPrice: gasOverrides.gasPrice?.mul(2),
76+
maxFeePerGas: gasOverrides.maxFeePerGas?.mul(2),
77+
maxPriorityFeePerGas: gasOverrides.maxPriorityFeePerGas?.mul(2),
8078
});
8179
} catch (err: any) {
8280
logger.worker.warn(

0 commit comments

Comments
 (0)