-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getTransaction breaks trying to access blockNumber of null response #2375
Comments
This issue seems to be related but happens for |
Yup, you're right. The |
Thanks for submitting this issue! I will fix and release it asap. |
This still happens on "1.0.0-beta.52"... const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://mainnet.infura.io/ws'));
const batch = new web3.BatchRequest();
batch.add(web3.eth.getTransaction.request('0x223b3f5892a7c20c333b68c4e95729100e7143a8c4ca8134502c3f0a2a87aadd', function (err, res) {
console.log(err);
}));
batch.execute();
// TypeError: Cannot read property 'blockNumber' of null
// ... |
Can be wrong, but looks like still happens on '1.2.1'. web3.eth.subscribe('pendingTransactions')
.on("data", async (txHash) => {
try {
let transaction = await web3http.eth.getTransaction(txHash);
console.log(transaction.from);
} catch (err) {
console.log(err.message);
}
})``` |
Expected behavior
The method
getTransaction
should returnnull
or error for specifying a non-existent transaction.Actual behavior
The method
getTransaction
breaks trying to accessblockNumber
ofnull
response.Steps to reproduce the behavior
getTransaction
with a transaction hash that does not exist, like 0x6b39f5caf5907ae686ac42f91527ab6897047027ce688f35b9e28ec4a21e8667, which is an existent transaction hash from the Rinkeby network.Error Logs
Versions
NPM: v6.15.1
Node: v10.15.1
Web3.js: 1.0.0-beta.46 (latest)
OS: Ubuntu 16.04
The text was updated successfully, but these errors were encountered: