add relay logic

This commit is contained in:
Jeff Thibault 2022-07-22 12:53:54 -04:00 committed by GitHub
parent 8bef0e9d79
commit d1b6bdb18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
22.md
View File

@ -21,3 +21,11 @@ Motivation
The motivation for this NIP is to prevent clients from saying they published an event *significantly* earlier than they actually did or saying they published an event in the future. The motivation for this NIP is to prevent clients from saying they published an event *significantly* earlier than they actually did or saying they published an event in the future.
The event `created_at` field is just a unix timestamp (integer) so one could set it to a time in the past or future. For example, the `created_at` field could be set to a time 10 years ago even though it was created today and it could still be a valid event. One could also set the `created_at` field to a time 10 years in the future and it could still be a valid event. This NIP aims to set a maximum amount of time elapsed between when an event was created and when it was *actually* published and prevent events from being from the future. The event `created_at` field is just a unix timestamp (integer) so one could set it to a time in the past or future. For example, the `created_at` field could be set to a time 10 years ago even though it was created today and it could still be a valid event. One could also set the `created_at` field to a time 10 years in the future and it could still be a valid event. This NIP aims to set a maximum amount of time elapsed between when an event was created and when it was *actually* published and prevent events from being from the future.
Relay Logic
-----------
```
if time.now - event.created_at > limit OR event.created_at > time.now:
send NOTICE
```