protocol: add checks for top block hard fork version

We won't even talk to a peer which claims a wrong version
for its top block. This will avoid syncing to known bad
peers in the first place.
Also add IP fails when failing to verify a block.
This commit is contained in:
moneromooo-monero 2017-08-09 09:31:00 +01:00
parent 7482253a6d
commit 635929eaca
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 22 additions and 0 deletions

View file

@ -195,10 +195,12 @@ namespace cryptonote
{
uint64_t current_height;
crypto::hash top_id;
uint8_t top_version;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(current_height)
KV_SERIALIZE_VAL_POD_AS_BLOB(top_id)
KV_SERIALIZE_OPT(top_version, (uint8_t)0)
END_KV_SERIALIZE_MAP()
};