You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using block.getTransaction("{0xTxHash}"), this will always fail due to a comparison issue in the Block class at src/providers/provider.ts.
async getTransaction(indexOrHash: number | string): Promise<TransactionResponse> {
// Find the internal value by its index or hash
let tx: string | TransactionResponse | undefined = undefined;
if (typeof(indexOrHash) === "number") {
tx = this.#transactions[indexOrHash];
} else {
const hash = indexOrHash.toLowerCase();
for (const v of this.#transactions) {
if (typeof(v) === "string") {
if (v !== hash) { continue; }
tx = v;
break;
} else {
if (v.hash === hash) { continue; } // <== This should be v.hash !== hash
tx = v;
break;
}
}
}
if (tx == null) { throw new Error("no such tx"); }
// ...
}
But it's kind of weird that I cannot reproduce this in the playground, but this error happens every time when I run the code locally. Btw I can create a PR for this if needed.
Ethers Version
6.13.4
Search Terms
provider
Describe the Problem
When using
block.getTransaction("{0xTxHash}")
, this will always fail due to a comparison issue in theBlock
class atsrc/providers/provider.ts
.But it's kind of weird that I cannot reproduce this in the playground, but this error happens every time when I run the code locally. Btw I can create a PR for this if needed.
Code Snippet
The following code should reproduce the issue:
await (await provider.getBlock(2000000, true)).getTransaction('0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef')
Contract ABI
No response
Errors
The error is `no such tx`
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: