mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 08:25:53 -05:00
add Giszmo, add comment in code example
This commit is contained in:
parent
e8a501c08f
commit
903cc0992e
5
22.md
5
22.md
|
@ -4,11 +4,11 @@ NIP-22
|
||||||
Event `created_at` Limits
|
Event `created_at` Limits
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
`draft` `optional` `author:jeffthibault`
|
`draft` `optional` `author:jeffthibault` `author:Giszmo`
|
||||||
|
|
||||||
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).
|
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).
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Client Behavior
|
Client Behavior
|
||||||
---------------
|
---------------
|
||||||
|
@ -37,5 +37,6 @@ LOWER_LIMIT = TIME - (60 * 60 * 24) # Define lower limit as 1 day into the past
|
||||||
UPPER_LIMIT = TIME + (60 * 15) # Define upper limit as 15 minutes into the future
|
UPPER_LIMIT = TIME + (60 * 15) # Define upper limit as 15 minutes into the future
|
||||||
|
|
||||||
if event.created_at not in range(LOWER_LIMIT, UPPER_LIMIT):
|
if event.created_at not in range(LOWER_LIMIT, UPPER_LIMIT):
|
||||||
|
# NOTE: This is one example of a notice message. Relays can change this to notify clients however they like.
|
||||||
ws.send('["NOTICE", "The event created_at field is out of the acceptable range (-24h, +15min) for this relay and was not stored."]')
|
ws.send('["NOTICE", "The event created_at field is out of the acceptable range (-24h, +15min) for this relay and was not stored."]')
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user