Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Get transaction by hash doesnt found tx sometimes #7177

Open
@juans-chainsafe

Description

@juans-chainsafe

Expected behavior

I want that this.provider.getTransaction(params[0]) doesnt fail at the first try if it doesnt found the transaction.

Actual behavior

”Transaction not found" error, but if you try again, the tx is there.

Workaround

 case "eth_getTransactionByHash": {
        let attempts = 0
        while (attempts < 10) {
          try {
            const receipt = await this.provider.eth.getTransaction(params[0])
            if (receipt) {
              return receipt
            }
          } catch (error) {
            console.error("Polling error: ", error)
          }

          await new Promise((resolve) => setTimeout(resolve, 1000))
          attempts += 1
        }

        throw new Error("Transaction receipt not found after max attempts")
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.x4.0 relatedEnhancementIncludes improvements or optimizationsP3Low severity bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions