Web3 did not return first mined block in pendingTransaction

Hi,

I run web3 and use parity RPC as provider for WebSocket.

Running using parity provide me with transaction with blockNumber: null and when the transaction mined.

But when I move to infura, I did not receive the transaction when its mined.

Is it a bug of web3, parity or infura ?

Hi rained23,

Welcome to our community site! When you say you run web3, are you referring to the web3.js Javascript library?

Can you share the code for the calls you are making to help us understand what you are seeing?

Michael

Yes. I am referring to web3.js.

const web3 = new Web3(
  new Web3.providers.WebsocketProvider(
    `wss://ropsten.infura.io/ws/v3/${PROJECT_ID}`,
  ),
);
const web3Http = new Web3(`https://ropsten.infura.io/v3/${PROJECT_ID}`);

web3.eth.subscribe('pendingTransactions').on('data', async tx => {
  try {
    const trx = await web3Http.eth.getTransaction(tx);
    console.log(trx);
   } catch(error) {
     console.log(error);
   }
};

[Web3.js + Parity] Output

{
hash: "0x1069d2dc3758af261b8f62331dd6dd525f4826305f49e45df95eb4b66b58a605",
blockHash: null,
blockNumber: null
}
{
hash: "0x1069d2dc3758af261b8f62331dd6dd525f4826305f49e45df95eb4b66b58a605",
blockHash: "0xce8e242f25cfb76cd9e3807317de7e5767cd3b758204e755a5f7d5e2832c2bd5",
blockNumber: 6552622,
}

[Web3.js + Infura] Output

{
hash: "0x1069d2dc3758af261b8f62331dd6dd525f4826305f49e45df95eb4b66b58a605",
blockHash: null,
blockNumber: null
}