Closed yeastplume closed 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.
Twofold 'belt and suspender' fix for #3681:
get_header_hash_by_height
intxhashset
to return an error if the header height requested is too large forpmmr::insertion_to_pmmr_index
to handle. Note there's no error handling in the core pmmr functions (which all assume arguments are correct, rightly or wrongly), so this check is placed as close to it as possible.get_server_stats
code. Note the call toget_header_by_height
is now needed here due to earlier performance optimizations on DifficultyIterator that removed the deserialization of proof nonces and left iterator entries unable to calculate their hash.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 fromget_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).