eth_getBlockByNumber provides info of uncled block

Hi,

I am requesting ropsten block 5000876 and I am getting in the response the data of the uncled block. The uncled block has occurred almost 1 hour ago… I was expecting to get the data of the validated block not the uncled block. Is this a bug or is my expectation incorrect??

My request:
curl -X POST --data ‘{“jsonrpc”:“2.0”,“method”:“eth_getBlockByNumber”,“params”:[“0x4c4eac”,false],“id”:3000}’ https://ropsten.infura.io/----mykey----

and the response I get is:
{“jsonrpc”:“2.0”,“id”:3000,“result”:{“difficulty”:“0x272b14fb”,“extraData”:“0xde830203018f5061726974792d457468657265756d86312e33312e31826c69”,“gasLimit”:“0x7a121d”,“gasUsed”:“0x42be28”,“hash”:“0x018a9cb238a822b1a99ff626a64070be54828864d83358c0974ccfb089786970”,“logsBloom”:“0x02800100040000150000801802830260a0200810804800000008000420000830600200005000000826880140000408002100009200210000040000008028044080020000002080000d08040c01c004008000004601804443000202003000010401048220c04000428000094040008008008003010120000d0808201026090a80010210210001000820a06000000000444000000a8020080290180042004021000154040012004402000000010000004200000c800120008400042013011600044004000200580244040c410000040000408008000400000010100a200c0000000800300008000101402000000808128060108000000000200800071208502022”,“miner”:“0xb17fc44dd79d21cd7f4d8c9686c98ae9039b3909”,“mixHash”:“0x5c5d391ade981e67742e1fc0c5b4ba964e7ff64e3363417e81a19a1187a862e9”,“nonce”:“0x2bb183a18bf9dbb6”,“number”:“0x4c4eac”,“parentHash”:“0x48d2d1eb02eb7287b388b45089c42f3c90d814d52fad9704d74dd5159629e0fc”, [cut here]

This is the output of etherscan:
Height: 5000876
TimeStamp: 45 mins ago (Feb-11-2019 11:11:49 PM +UTC)
Transactions: [88 transactions] and 1 contract Internal Transaction in this Block
Hash: 0x1600d58a50ec570e5f9d373d581940ae57d6ee090283df473e2e8fba836a0495
Parent Hash: [0x48d2d1eb02eb7287b388b45089c42f3c90d814d52fad9704d74dd5159629e0fc]

The block hash is not the same.
Would appreciate a response on this.
Rgds
Santi

It looks like you were unlucky and queried that block around the time of a reorg on Ropsten. Looking at it now, this is the data I’m getting back on Ropsten:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x4c4eac",false],"id":3000}' https://ropsten.infura.io/v3/my-key | jq .
{
  "jsonrpc": "2.0",
  "id": 3000,
  "result": {
    "difficulty": "0x272b14fb",
    "extraData": "0xde830203018f5061726974792d457468657265756d86312e33312e31826c69",
    "gasLimit": "0x7a121d",
    "gasUsed": "0x42be28",
    "hash": "0x1600d58a50ec570e5f9d373d581940ae57d6ee090283df473e2e8fba836a0495",
    "logsBloom": "0x02800100040000150000801802830260a0200810804800000008000420000830600200005000000826880140000408002100009200210000040000008028044080020000002080000d08040c01c004008000004601804443000202003000010401048220c04000428000094040008008008003010120000d0808201026090a80010210210001000820a06000000000444000000a8020080290180042004021000154040012004402000000010000004200000c800120008400042013011600044004000200580244040c410000040000408008000400000010100a200c0000000800300008000101402000000808128060108000000000200800071208502022",
    "miner": "0xb17fc44dd79d21cd7f4d8c9686c98ae9039b3909",
    "mixHash": "0x664510f5ceb9da17e653b73faf0d849dd4176ad3927286e5f94f5b9c3072a271",
    "nonce": "0x2bb183a18bec0278",
    "number": "0x4c4eac",
    "parentHash": "0x48d2d1eb02eb7287b388b45089c42f3c90d814d52fad9704d74dd5159629e0fc",
    "receiptsRoot": "0x412a36f200ad2ba6189b8322543440cfa2f4cf6890960f4f31e699aee47a2451",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x3bfe",
    "stateRoot": "0xac4fa3f07efdf9724f6fd11dd2cda4dd21aac0881723d7c29cdb0e5e05f09e5e",
    "timestamp": "0x5c620135",
    "totalDifficulty": "0x40dce1327ae78e",
    "transactions": [
      "0xa89e47edf4e5294926bfc433a657d6c74bb32137e4a44f9c8dc4286e7797317a",
      "0x788ca828555ea23962ee88dde5ea6d01a3df332bb757c31196c980f9ca34b1f5",
      "0x15f828c928d9e1251cbb313e686a8b4397e68f6198fcb1d1f5c54a6b398055d0",
      "0xd86876948d8999a1b8db3f1469ce20b536d08ca8c0c4b58bbee14e0e6cb110e5",
      "0x41cd0ad8ce1bec17b26ee985388e5fca45f8d27ec3a7a734774468748644a9e8",
      "0x49b8463ba614c068c5cd1192cd3f9d572b209ace3d37a7d5c65c758dc5fa88fc",
      "0xb375be40881ede70b2ba0824b3e14cd3d5f6c437d800a5bfb408c702d9a42d07",
      "0x0460833d5da7fb1fd91d49d4990d6ea756b6dcd9f625f2d3226c83f2ea357a0b",
      "0x1658e57e3b3696146dea9aa79655a800113a1e4d95460a75d63e4a31cfd64733",
      "0x3e64c0b2de40bfbf60089024c11d32616aa4705cbfc119ee331a419ed2693efc",
      "0xbc2440490fa06722db5038bb16f9400f9bfc7292216293761642b82b60ac921f",
      "0x51b9fa472dee828f61e91eeaf56218b51d18bbb71ef03ff1301379cd9da0cca9",
      "0xfb4f4d5bb498ee600db564cfe4955d71a0bad577bcea85ceed9da9cdb0fbc4ff",
      "0xbd6a5a8573f1f5a8880148d9f418570026ef77142407b180026166549663d554",
      "0x35dc1583fcf00029dbfa0305065c036ddd6e771adc866bf390afd89fb097dab0",
      "0x7f87edfd25e5e59919106cec11b5e8e3c7ab12374e9c4018d8f1b4fab0ea7c61",
      "0x91e69ca8a68d8d47ff114547015535480b9f483e8086a373ae44864aba498d3a",
      "0x6713e74df46c5d212db0420afb48d8c17e05bc5734147eba6b19faae2dcd797e",
      "0x6feff8141d27c5eee54a7dae0ea1e0724439b1383d0636f3e3f5b18f8cc1d620",
      "0x0cccb2da74e6396259eb3151a3df7d6f0de6f1da6fab7a037d91c281e9fa6ce5",
      "0xdbc4b838f467ea4e4703b9d7797f2d6ebef91502e5e35caecbeb3967eb94e3d9",
      "0x0ec2850f28392ff58f4ad16eb60f5d89fd3fad9068907cdbcf212f5cc42179ba",
      "0xfe7e38898b855d7dc312bbd2ce8490c95ace3f6060ecc0138d6b6dc0038fa023",
      "0x1e9f1cfb058d6e46f916b8fd9de7cb28c5994ae3277daa874df790f028235622",
      "0x8fb984d96a73d26a1a3c5524d470fcbab20dd132b9076cf7bab422879b05194b",
      "0x7afe9a1170c4261252bc9a25ee98ec0dd5152bf2a6bb073049a98e041531bbe3",
      "0x0123952d3a338acb14a37afcde6aac0b4c39b2719000da5b3e66fdec3148b049",
      "0xa61fba41cff580d94c55a9c8d864ea6634c0d35cfa14d5a14456bd0017f0e431",
      "0xf3e2ce9b45819968d29034d1ed5c0ce801c3bf35f129cd36b587c90ca200432e",
      "0x06d298d0174ad660deb09758243e096ba32b53d42b8e906a0de4dc6cc7c45088",
      "0xc6b997de11a0828703b616e56725e085bc70315d949a5ae114fecc85b6ba4061",
      "0x1967346d75a48dcf578530a2fd34c4868e948b27092e6fa3430cd31c419750af",
      "0xb2514b2ae0d32df47f521fd70f0477d6044ad6e3e5331aacfbf0d8da15fe5101",
      "0x17e5a3b7cc8a886c409a9bf2b4302412ca4398cb53a1f9be9d62ea294e97320a",
      "0xa83dac361c4426e4a4b7abe5f9d48e2e92f783c07029acaf1547e5ec91cbbf9b",
      "0xc0e23bf2927a640549b406728ce8fba0b570d51981097d0f6bfba8e6d2da34d7",
      "0x270fb03caf528392ab0f5a2433b50f8ad78f33a5d8a2cde71cbb99ec4b54a333",
      "0xc88998091eae6d7c287e71a550443da6dd64a02cd7985687fde3ff7940421bfd",
      "0xe24bbc25ec74cbbc2f2b0412f775092f27ee8f81468f93bfd39cea20729dad28",
      "0x42fdacb343bdc59d7895f887124ec9f37d198d6bf2d310239e6abb95d2aa45c9",
      "0x7d7f7b79e1476cdc423d4bd7a70cc1c334debf5227057d4661e9062d4a9d4ff3",
      "0xa5016d5cfc319fddbe609c2952f0d69afedbc4f7c9e03def78e5612320462c6e",
      "0x75715ad1f9c835316e3d315d76073914ab3052df9e1dafd0407d2c9ddcbf7d27",
      "0x84228c66f602e9f721017eddc654f9b927bbb679c75fd5bf0f846fe80974d659",
      "0x0505bd8d9d7139601d33f3b0aeb3b78cd20e695866cbc35109fa3975925d4fff",
      "0x544a6848eb77dd337ba6140854a9c75adff224c3350af1455c6cd838ff5a7da0",
      "0x622019361a01cf1315880498bc61cf895a66a227262400a2e19a9cec893b5bac",
      "0x9afdd93485343aaabc4a334d2c16638a697004e0f0b3d6baff1099bc4e1fd81d",
      "0x9a329e137ff0103d87555b8570c1bb57186e6035e8815e2b02659dca7cb39589",
      "0x06a21e1098e08e774abe5ba832dce9986adaf5dccd6d7b5447cbcb61cef555a2",
      "0xcbec7f6ec57c810563761cc83eef32c918f231c2b21745b89c8c29d338c72e8d",
      "0xa7cb16e6d3adf19058c3ac5907dd5e8bf5e85fa0083c0bce858cd8db03071c1b",
      "0x4dfa3382806bbe2d96b9e1e7649b4f5cd85b5cead88025d0d1079b5045a76d9f",
      "0x87104fc387df2a2edbaa6d630e802f8a5d74014b18a7f8fdbc7d98ecd221302c",
      "0xd132c06e85be551e485b5a8f20fe992d8d914c4c7a1507821992bb7abf8b2ccb",
      "0xfacc9beebb7667989ae86798dd04197a454d5fa60a0cb392fef13aa008101382",
      "0x8f85285e87156be399c2c39a54aaf215bbce7f63b14ac6a3057428a17e87976f",
      "0x0fa1f2fb82c250f5916e4c8acc035711e5c7f5800de5d7daed62b9fca771701d",
      "0xe9a223e83a112b7de5e4fc4ef246f91734e5d9c10318f563a4f0cf936dcc5875",
      "0xdffcbbf13f6bb9a75558933bdb6904b2b61f8bf1be125d655c841134e2b33d7a",
      "0x4d99b63e7668440ece09cee8bedbbe3bed675d73ec92f8cffd652f606829ee20",
      "0x1359eb7937ae6480c46c109882a53ffd3587726e986ea525c3f6702bc3d70ce4",
      "0x2beed51408f8c5d84a63c553ce333243c06f78ffa84284b8be29784a565e3b26",
      "0xfc6a633522d181fda994dd2d518e72780d0712004292aa48c6e5f39bfaaa3b01",
      "0x1ce4162ced0a89eadc9eb9aeed44e8df83fe1d6ddaf90705f1c1f05aa0b0e3d3",
      "0xd744e7497a601c75c5d983462ebf4e0eb6e41d2358adf264d00697bc9e07366a",
      "0x51c51ed832d25934f63a141be52aac7491fa5bb8381504858a1ae6c9bdd04ed3",
      "0x1551e2ac24fba9cf652eb48b3368a486b0322bfad735c2deff5bdb2631ed021f",
      "0x8df919c5692d0d4d012274a224d3dc841e738f647e8dc763ad5cd03ef2a189b4",
      "0x2154e131f82a6c3c83a040224907a1dbfc36a1766580414856bd56075944442e",
      "0x3968f5a9f83390488606c778b3d146b153023bde163b2585651b3075a9307af0",
      "0x8faa1d7417fa79e42f6b765748d2aa69d6ec6067f1f0a05677797f9afa6fed34",
      "0x002734e143cf9de4718a55cc9ba07bfd85305abeb277139083e5fea90ddee9e8",
      "0xafb1bfd30885491b3ce4e590a289ae3c4f34a9c6785132646b567dffecba1816",
      "0x5b45b0f87cc827df508d2ca9656c2e0dc7bdae41644e440700d7db82ed38b8a2",
      "0x193cb67fd81e0ca3087c0536af76cd835345feb75d574d9e473e693d6739e84e",
      "0x0afd202ee3c6dad49d84e9f2d959ab8096dd439cb9f00772e70ba00c769c4561",
      "0x3b3dd8f8c010450feea4689966edeb53b9c18160d29e30650bf9c47d57cab4a9",
      "0x41693a0a381594f7967141a0112f28679808ce777fbf95e411a6a236825e3459",
      "0x13269ee60dc039d4c2454866b2de12b224009842ab1533a66effb0099e4f7e13",
      "0xc58c1136c6c9c6f256fc567d73bcbabba5430950029b86d03ee400f58d91bd1c",
      "0x0cbeaa712377c2f8c0db93b46ea26be16ab5a2a362bdf1c6746351db97f2546c",
      "0xf83694c9c2af2e9df364e5bb38d7954f8ceca9a55bff96c87c900fc79448f21a",
      "0x012ed68efa8c4d36c66a4d0dfffae1a2a5a76bef726605b41c0124b6f514de3f",
      "0x620ad9258fe98e6831f7e1add062d2b9786f6b7ece3b0fd541114223e4a573e6",
      "0xf053eaf17325c890b8016e9cf62b90dd7dbee61a11789de9978bea652901578a",
      "0xb2bcff08bdd8854c7d3999366048a9054c4f343bcadac38b8be7f9b4bd1a7cce",
      "0x3630aa6c85eabebca29dbf4fcdb03bc965d3b0395a4f45ae02e8c24e5938f3f4"
    ],
    "transactionsRoot": "0xc0c9789447ec01c150e6fa8ee9e39934f800267932152f9da77ee6112303df53",
    "uncles": []
  }
}

Hi, the same thing is happening again… I am looking at blocks 5010675 and 5010676 at ropsten. At the time I have checked them these blocks are one-hour old according to etherscan.io. When I use the eth_GetBlockByNumber API call for both blocks, parentHash of block 5010676 is not equal than the previous block but points to an uncled block… so it’s like the chain is broken but the node still provides information about the blocks. Should the node not say that it’s syncing or reorging its chain??

After a while, I have recheched again both blocks, and now it does provide the two blocks with the correct hash and parentHash fields in the response.

However, I feel like I cannot trust the node to provide correct info of blocks ocurred within the last hour. I wonder whether the same will happen when the mainnet also runs Constantinople.

We identified an issue with our CDN incorrectly caching Ropsten blocks near head, this issue is resolved, thanks for reporting it.

perfect, many thanks.
The issues have dissapeared on my app too.

Same issue still happend to me.

Here is some of my log.

[2019-04-13 06:57:03] local.INFO: scan eth  {"block_number":"7558138"}
[2019-04-13 06:57:04] local.DEBUG: get block by number {"blockBody.result.transactions":["0x97c5d99f2cfd9d06d056cd3cfd93813891c08246059e50f97ee83462ffb848f0","0x6e2afb8678723e35de736012fb9c3cf5539764d21656d442545c71ad3737110d","0xad72b7bcd8abba476e42edd3ff4e95f3895dd2bf13b78c3adc95675a8d2139b3",

And if I run it after some hours

[2019-04-13 09:59:43] local.INFO: scan eth  {"block_number":"7558138"}
[2019-04-13 09:59:43] local.DEBUG: get block by number {"blockBody.result.transactions":["0x38071a4cd428e35bccb7b923e5d85893365d9df485a5854dc0ac8208c99a16eb","0xe924e3da4a61457aaf850c9778ba8c509da48981d30e3fac9bcf1231f532bb01","0xf4e0f460475b0a1d705bbfe1573c59eba84a3bdcdefe04f4c2054a727b9add50",

It work corrcetly.
So does change my app to wait about one mintues will solve this problem?But it’s mainnet not testnet

Can you provide the code that is making the request and the full error response?