tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.45k stars 465 forks source link

Request for existing block ends up with None to be returned #681

Closed ababo closed 1 year ago

ababo commented 1 year ago

To reproduce the issue I use the following code:

    use web3::transports::Http;
    use web3::types::{BlockId, BlockNumber, U64};
    use web3::Web3;
    let transport = Http::new(
        "https://goerli.infura.io/v3/<KEY>",
    )
    .unwrap();
    let eth = Web3::new(transport).eth();
    let block_id = BlockId::Number(BlockNumber::Number(U64::from(16504309)));
    let block = eth.block_with_txs(block_id).await.unwrap();
    dbg!(block);

I get "None" printed. If I do the same using curl I get block contents as expected:

curl https://mainnet.infura.io/v3/<KEY>\
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0xFBD5F5", true],"id":1}'
ababo commented 1 year ago

Confused goerli with mainnet.