{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1473","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1473/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1473/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1473/events","html_url":"https://github.com/ethereum/go-ethereum/issues/1473","id":94956980,"number":1473,"title":"[critical/rpc] eth_getTransactionByHash returns null instead of transaction object","user":{"login":"debris","id":2613714,"avatar_url":"https://avatars.githubusercontent.com/u/2613714?v=3","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-14T14:28:20Z","updated_at":"2015-07-14T16:11:43Z","closed_at":null,"body":"### geth version\r\n\r\n```\r\nGeth\r\nVersion: 0.9.39\r\nProtocol Versions: [61 60]\r\nNetwork Id: 0\r\nGo Version: go1.4.2\r\nOS: darwin\r\nGOPATH=/Users/marekkotewicz/go\r\nGOROOT=/usr/local/go\r\n```\r\n\r\n### problem description:\r\n\r\nAfter reverting head of the chain. `eth_getTransactionByHash` doesn't work for some blocks ( I made them **bold** )\r\n\r\n......1 - 2 - 3 ... 26 - 27a - 28a\r\n...........................\\ - **27b** - **28b** - 29 - 30 - 31 - 32\r\n\r\n\r\n### steps to reproduce:\r\n\r\n- load test blockchain with reverted head (make sure you are on latest develop).\r\n  ```bash\r\ngeth --shh blocktest lib/tests/BlockChainTests/bcRPC_API_Test.json RPC_API_Test rpc\r\n  ```\r\n\r\n- curl `eth_getBlockByHash`\r\n\r\n  ```bash\r\ncurl -X POST --data '{\"id\":8,\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x40aa08130f1db5cb3ad79c77e63b2fc3f57c5a9ad1f39acaaf9b0dddda0ece0c\", true]}' -H \"Content-Type: application/json\" http://localhost:8545\r\n  ```\r\n\r\n  ```json\r\n{\r\n\t\"id\": 8,\r\n\t\"jsonrpc\": \"2.0\",\r\n\t\"result\": {\r\n\t\t\"number\": \"0x1c\",\r\n\t\t\"hash\": \"0x40aa08130f1db5cb3ad79c77e63b2fc3f57c5a9ad1f39acaaf9b0dddda0ece0c\",\r\n\t\t\"parentHash\": \"0xca868c969d9fa0f0d9ad3b96d91c78877b95212140158475b00ee795e16b5d39\",\r\n\t\t\"nonce\": \"0x9b965af1ce6b9f6e\",\r\n\t\t\"sha3Uncles\": \"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\",\r\n\t\t\"logsBloom\": \"0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000040000000000000000000000000000000000000000000000000000000000000000000\",\r\n\t\t\"transactionsRoot\": \"0x323987ceb9e12e900fdef1cb05df4f199f104c6a6a5596a8d36018ce232235ac\",\r\n\t\t\"stateRoot\": \"0xc0353d0d5da74d43b9d424ab4972b30104586d64cb82ddf2c03a3f877678a781\",\r\n\t\t\"miner\": \"0x8888f1f195afa192cfee860698584c030f4c9db1\",\r\n\t\t\"difficulty\": \"0x20640\",\r\n\t\t\"totalDifficulty\": \"0x3a5280\",\r\n\t\t\"size\": \"0x268\",\r\n\t\t\"extraData\": \"0x\",\r\n\t\t\"gasLimit\": \"0x2fefd8\",\r\n\t\t\"gasUsed\": \"0x59d9\",\r\n\t\t\"timestamp\": \"0x55a4d6ce\",\r\n\t\t\"transactions\": [\r\n\t\t\t{\r\n\t\t\t\t\"hash\": \"0x6dc5be7d29e7a79344cbbc8234f5e8467c65dea58df72faf634c275e5c4930ed\",\r\n\t\t\t\t\"nonce\": \"0x1b\",\r\n\t\t\t\t\"blockHash\": \"0x40aa08130f1db5cb3ad79c77e63b2fc3f57c5a9ad1f39acaaf9b0dddda0ece0c\",\r\n\t\t\t\t\"blockNumber\": \"0x1c\",\r\n\t\t\t\t\"transactionIndex\": \"0x0\",\r\n\t\t\t\t\"from\": \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\r\n\t\t\t\t\"to\": \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\",\r\n\t\t\t\t\"value\": \"0xa\",\r\n\t\t\t\t\"gas\": \"0x4cb2f\",\r\n\t\t\t\t\"gasPrice\": \"0x1\",\r\n\t\t\t\t\"input\": \"0x76bc21d9\"\r\n\t\t\t}\r\n\t\t],\r\n\t\t\"uncles\": []\r\n\t}\r\n}\r\n  ```\r\n\r\n  *we received block with one transaction. Now lets ask for this transaction using block hash and index*\r\n\r\n- curl `eth_getTransactionByBlockHashAndIndex`\r\n\r\n  ```bash\r\ncurl -X POST --data '{\"id\":8,\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x40aa08130f1db5cb3ad79c77e63b2fc3f57c5a9ad1f39acaaf9b0dddda0ece0c\", \"0x0\"]}' http://localhost:8545\r\n  ```\r\n\r\n  ```json\r\n{\r\n\t\"id\": 8,\r\n\t\"jsonrpc\": \"2.0\",\r\n\t\"result\": {\r\n\t\t\"hash\": \"0x6dc5be7d29e7a79344cbbc8234f5e8467c65dea58df72faf634c275e5c4930ed\",\r\n\t\t\"nonce\": \"0x1b\",\r\n\t\t\"blockHash\": \"0x40aa08130f1db5cb3ad79c77e63b2fc3f57c5a9ad1f39acaaf9b0dddda0ece0c\",\r\n\t\t\"blockNumber\": \"0x1c\",\r\n\t\t\"transactionIndex\": \"0x0\",\r\n\t\t\"from\": \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\r\n\t\t\"to\": \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\",\r\n\t\t\"value\": \"0xa\",\r\n\t\t\"gas\": \"0x4cb2f\",\r\n\t\t\"gasPrice\": \"0x1\",\r\n\t\t\"input\": \"0x76bc21d9\"\r\n\t}\r\n}\r\n  ```\r\n\r\n  *it works! Now lets ask for this transaction using transaction hash*\r\n\r\n- curl `eth_getTransactionByHash`\r\n\r\n  ```bash\r\ncurl -X POST --data '{\"id\":8,\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0x6dc5be7d29e7a79344cbbc8234f5e8467c65dea58df72faf634c275e5c4930ed\"]}' http://localhost:8545\r\n  ```\r\n\r\n  ```json\r\n{\r\n\t\"id\": 8,\r\n\t\"jsonrpc\": \"2.0\",\r\n\t\"result\": null\r\n}\r\n  ```\r\n\r\n  *I expected to get same result as before. Instead I got `null`*\r\n\r\n### tests to reproduce:\r\n\r\nThe test is available in `rpc-tests` repo pr. You can run it by typing `make test.eth`.\r\n\r\nhttps://github.com/ethereum/rpc-tests/pull/5\r\n"},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/121293303","html_url":"https://github.com/ethereum/go-ethereum/issues/1473#issuecomment-121293303","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1473","id":121293303,"user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T16:11:43Z","updated_at":"2015-07-14T16:11:43Z","body":"Thanks. I've identified the issue and working on a fix. It would be great if you could test the PR later today/tomorrow and let me know if the issue persists (or give me directions on how to test the RPC myself :+1:)"}}