mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 989 forks source link

Handle attempts to get block headers at invalid heights #3683

Closed yeastplume closed 2 years ago

yeastplume commented 2 years ago

Twofold 'belt and suspender' fix for #3681:

Either fix on its own would work, but get_header_by_height should be returning an error for invalid heights, while the call to it from get_server_stats shouldn't be attempting to provide invalid heights via an incorrect cast. (Note that casting from i64 to u64 is allowed in rust regardless of value, meaning that -59i64 to u64 results in 18446744073709551557).

phyro commented 2 years ago

I have run the initial sync that broke before and it no longer does. Apart from the minor comment from tromp, the changes look good :+1: I was not able to sync the node, but I now suspect the problem is on my end with the disk.