Geth version: develop branch
OS & Version: Arch Linux
Commit hash : ed2bc7fbe9a30c1861cffdd7d0fd570847a2ae0c
ethclient.HeaderByNumber should return a *types.Header instance
JSON unmarshal error: missing mixHash in JSON block header
You get this error because the server did not return all required fields. The field is needed because we cannot recompute the header hash correctly if mixHash is missing.
Can this be because of an inconsistency between Parity's and Geth's JSON
API?
On 11/03/2016 06:10 PM, Felix Lange wrote:
You get this error because the server did not return all required fields.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ethereum/go-ethereum/issues/3230#issuecomment-258208709,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA0F3ITYVjhzvj0uttEkx8cWYBFKRbMRks5q6hV4gaJpZM4Koqd-.
The only server implementation that returns this field is geth 1.5.0, which is not released yet. If you are using parity please ask them to include this field in API responses.
This is now fixed in the parity master branch, closing.
I seem to have bumped into this again. Just started using stable Parity.
I have the same issue also. @stevenroose would you mind reopen this issue again? Thanks.
Parity version: v2.0.3-beta-a0a2bed-20180831
@dtco-kimi I don't have reopen permissions, sorry. You should ask @fjl
It seems like this problem only occurs when using Parity against Kovan (POA chain). There, the field is not returned. When running Parity against ropsten it actually returns the field.
Contrary to that, geth returns 0x0 in the mixHash field when running against Rinkeby (also POA) thus allowing clients to rely on the field always being there.
It would be great if the go-ethereum ethclient would gracefully ignore the field not being present. I don't know if there's an easy way to distinguish between POA/POW chains and only error out when interacting with a POW chain and the field is missing. That could be a good solution.
Having the same Issue with my own POA (Parity) Network. Would be glad if the suggestion of pstehlik could be somehow implemented :)
As I am writing this I really think I should not post this, but as a quick fix you can just modify those lines in the json unmarshaller in https://github.com/ethereum/go-ethereum/blob/master/core/types/gen_header_json.go .
// if dec.MixDigest == nil {
// return errors.New("missing required field 'mixHash' for Header")
// }
if dec.MixDigest != nil {
h.MixDigest = *dec.MixDigest
}
// if dec.Nonce == nil {
// return errors.New("missing required field 'nonce' for Header")
// }
if dec.Nonce != nil {
h.Nonce = *dec.Nonce
}
A better way would be of having the possibility of creating a header type just for a POA chain which does not require Nonce and MixDigest. But I am still not in the code, yet so there might be a better way to solve this.
Most helpful comment
It seems like this problem only occurs when using Parity against Kovan (POA chain). There, the field is not returned. When running Parity against ropsten it actually returns the field.
Contrary to that, geth returns
0x0in themixHashfield when running against Rinkeby (also POA) thus allowing clients to rely on the field always being there.It would be great if the go-ethereum ethclient would gracefully ignore the field not being present. I don't know if there's an easy way to distinguish between POA/POW chains and only error out when interacting with a POW chain and the field is missing. That could be a good solution.