From 8e35b8b7ad452ce3afb7ec2729d9108e09ee65f6 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 14 Dec 2018 21:23:02 -0600 Subject: [PATCH] do not save blocks that are set for the future --- onionr/onionrutils.py | 3 +++ onionr/static-data/default_config.json | 1 + 2 files changed, 4 insertions(+) diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index e06c1e27..a6f57013 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -391,6 +391,9 @@ class OnionrUtils: if not self.isIntegerString(metadata[i]): logger.warn('Block metadata time stamp is not integer string') break + if metadata[i] > self.getEpoch(): + logger.warn('Block metadata time stamp is set for the future, which is not allowed.') + break elif i == 'expire': try: assert int(metadata[i]) > self.getEpoch() diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index 5003d73b..5532797d 100644 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -6,6 +6,7 @@ "minimum_send_pow": 5, "socket_servers": false, "security_level": 0, + "max_block_age": 2678400, "public_key": "" },