diff options
| author | Jeff Thibault <jdthibault2@gmail.com> | 2022-08-14 11:26:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-14 11:26:39 -0400 |
| commit | 903cc0992eedd752a688ce11c77d8a7bea57ae82 (patch) | |
| tree | 87b59b9aba0b58f089d302a161b617ba22459c07 | |
| parent | e8a501c08ffb9f99eb823419957cce5cf80a3e44 (diff) | |
add Giszmo, add comment in code example
| -rw-r--r-- | 22.md | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -4,11 +4,11 @@ NIP-22 | |||
| 4 | Event `created_at` Limits | 4 | Event `created_at` Limits |
| 5 | --------------------------- | 5 | --------------------------- |
| 6 | 6 | ||
| 7 | `draft` `optional` `author:jeffthibault` | 7 | `draft` `optional` `author:jeffthibault` `author:Giszmo` |
| 8 | 8 | ||
| 9 | Relays may define both upper and lower limits within which they will consider an event's `created_at` to be acceptable. Both the upper and lower limits MUST be unix timestamps in seconds as defined in [NIP-01](01.md). | 9 | Relays may define both upper and lower limits within which they will consider an event's `created_at` to be acceptable. Both the upper and lower limits MUST be unix timestamps in seconds as defined in [NIP-01](01.md). |
| 10 | 10 | ||
| 11 | If a relay supports this NIP, the relay SHOULD send the client a `NOTICE` message saying the event was not stored for the `created_at` not being within the permitted limits. | 11 | If a relay supports this NIP, the relay SHOULD send the client a `NOTICE` message saying the event was not stored for the `created_at` timestamp not being within the permitted limits. |
| 12 | 12 | ||
| 13 | Client Behavior | 13 | Client Behavior |
| 14 | --------------- | 14 | --------------- |
| @@ -37,5 +37,6 @@ LOWER_LIMIT = TIME - (60 * 60 * 24) # Define lower limit as 1 day into the past | |||
| 37 | UPPER_LIMIT = TIME + (60 * 15) # Define upper limit as 15 minutes into the future | 37 | UPPER_LIMIT = TIME + (60 * 15) # Define upper limit as 15 minutes into the future |
| 38 | 38 | ||
| 39 | if event.created_at not in range(LOWER_LIMIT, UPPER_LIMIT): | 39 | if event.created_at not in range(LOWER_LIMIT, UPPER_LIMIT): |
| 40 | # NOTE: This is one example of a notice message. Relays can change this to notify clients however they like. | ||
| 40 | ws.send('["NOTICE", "The event created_at field is out of the acceptable range (-24h, +15min) for this relay and was not stored."]') | 41 | ws.send('["NOTICE", "The event created_at field is out of the acceptable range (-24h, +15min) for this relay and was not stored."]') |
| 41 | ``` | 42 | ``` |