Improve bounding block timestamp (#793)

Fixes #783.
* 2^60 still fails on OSX, experimentally found safe max 2^55
* Handle negative values

I tried to use .abs(), unfortuantely fuzz test kills it with
`panicked at 'attempt to negate with overflow', /Users/travis/build/rust-lang/rust/src/libcore/num/mod.rs:1146:17`
This commit is contained in:
Alexey Miroshkin 2018-03-16 23:20:40 +01:00 committed by Ignotus Peverell
parent b53b84b0c6
commit c96838d54d

View file

@ -169,7 +169,7 @@ impl Readable for BlockHeader {
let nonce = reader.read_u64()?;
let pow = Proof::read(reader)?;
if timestamp > (1 << 60) {
if timestamp > (1 << 55) || timestamp < -(1 << 55) {
return Err(ser::Error::CorruptedData);
}