Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Nov 10, 2024
1 parent 7e7593f commit 6702820
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/cli/setupServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const getCompressionHandler = async (
}

const getExecutor = ({
mempool,
config,
senderManager,
reputationManager,
Expand All @@ -124,6 +125,7 @@ const getExecutor = ({
gasPriceManager,
eventManager
}: {
mempool: MemoryMempool
config: AltoConfig
senderManager: SenderManager
reputationManager: InterfaceReputationManager
Expand All @@ -133,6 +135,7 @@ const getExecutor = ({
eventManager: EventManager
}): Executor => {
return new Executor({
mempool,
config,
senderManager,
reputationManager,
Expand Down Expand Up @@ -299,6 +302,7 @@ export const setupServer = async ({
})

const executor = getExecutor({
mempool,
config,
senderManager,
reputationManager,
Expand Down
14 changes: 9 additions & 5 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ export class Executor {
...opts
})

let isTransactionUnderPriced = false
let attempts = 0
let transactionHash: Hex | undefined
const maxAttempts = 3
Expand All @@ -562,11 +563,6 @@ export class Executor {
if (isTransactionUnderpricedError(e)) {
this.logger.warn("Transaction underpriced, retrying")

await this.handleTransactionUnderPriced({
nonce: request.nonce,
executor: request.from
})

request.maxFeePerGas = scaleBigIntByPercent(
request.maxFeePerGas,
150
Expand All @@ -576,6 +572,7 @@ export class Executor {
150
)
isErrorHandled = true
isTransactionUnderPriced = true
}
}

Expand Down Expand Up @@ -622,6 +619,13 @@ export class Executor {
}
}

if (isTransactionUnderPriced) {
await this.handleTransactionUnderPriced({
nonce: request.nonce,
executor: request.from
})
}

// needed for TS
if (!transactionHash) {
throw new Error("Transaction hash not assigned")
Expand Down

0 comments on commit 6702820

Please sign in to comment.