diff options
| author | Jeff Thibault <jdthibault2@gmail.com> | 2022-07-22 12:53:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-22 12:53:54 -0400 |
| commit | d1b6bdb18e522fa34ff7cfec3d56318da596fdff (patch) | |
| tree | 4e047a75a43f56f4e4aae3ad54421a5469879a10 /22.md | |
| parent | 8bef0e9d79ebb4b11f8fd2bea11dc8f1668bc9d0 (diff) | |
add relay logic
Diffstat (limited to '22.md')
| -rw-r--r-- | 22.md | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -21,3 +21,11 @@ Motivation | |||
| 21 | 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. | 21 | 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. |
| 22 | 22 | ||
| 23 | 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. | 23 | 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. |
| 24 | |||
| 25 | Relay Logic | ||
| 26 | ----------- | ||
| 27 | |||
| 28 | ``` | ||
| 29 | if time.now - event.created_at > limit OR event.created_at > time.now: | ||
| 30 | send NOTICE | ||
| 31 | ``` | ||