Skip to content

Commit

Permalink
check all mempools
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless-eth committed Sep 6, 2024
1 parent 563dfe9 commit eff96f8
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/mempool/mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,23 @@ export class MemoryMempool {
const userOperation = deriveUserOperation(mempoolUserOperation)

const isSameSender = userOperation.sender === op.sender
const isSameNonce = userOperation.nonce === op.nonce

if (isSameSender && userOperation.nonce === op.nonce) {
if (isSameSender && isSameNonce) {
return true
}

return false
})

const conflictingUserOp = [
...outstandingOps,
...processedOrSubmittedOps
].find(({ mempoolUserOperation }) => {
const userOperation = deriveUserOperation(mempoolUserOperation)

const isSameSender = userOperation.sender === op.sender

// Check if there is already a userOperation with initCode + same sender (stops rejected ops due to AA10).
if (
isVersion06(userOperation) &&
Expand Down Expand Up @@ -321,8 +333,10 @@ export class MemoryMempool {
return false
})

if (oldUserOp) {
const oldOp = deriveUserOperation(oldUserOp.mempoolUserOperation)
const opToReplace = oldUserOp || conflictingUserOp

if (opToReplace) {
const oldOp = deriveUserOperation(opToReplace.mempoolUserOperation)
const oldMaxPriorityFeePerGas = oldOp.maxPriorityFeePerGas
const newMaxPriorityFeePerGas = op.maxPriorityFeePerGas
const oldMaxFeePerGas = oldOp.maxFeePerGas
Expand All @@ -349,7 +363,7 @@ export class MemoryMempool {
return [false, reason]
}

this.store.removeOutstanding(oldUserOp.userOperationHash)
this.store.removeOutstanding(opToReplace.userOperationHash)
}

// Check if mempool already includes max amount of parallel user operations
Expand Down

0 comments on commit eff96f8

Please sign in to comment.