In the go-ethereum code, I see functions use both the number and block hash to locate a block.

Why is that? Isn't block hash enough?

An example function: https://github.com/ethereum/go-ethereum/blob/eea3ae42a3d9bcbd33474c0e482754c5196a469f/core/block_validator.go#L53

  • 2
    I'm not a geth dev, hope a real one provides the solution, but I'm guessing they do it so lookup is more efficient, if I know it's bock 5 with hash 0x321a I don't need to look for that hash in every block, I just go to the 5th one and check hashes – Enrique Alcazar Nov 20 '18 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.