Allow relays indicate whether probabilistic count was used in NIP-45

This commit is contained in:
Viktor Vsk 2023-08-27 15:34:55 +02:00 committed by GitHub
parent 50945f7150
commit 21f3ad5a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

5
45.md
View File

@ -21,6 +21,7 @@ This NIP defines the verb `COUNT`, which accepts a subscription id and filters a
```
Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements.
In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`.
```
["COUNT", <subscription_id>, {"count": <integer>}]
@ -36,4 +37,8 @@ Examples:
# Count posts and reactions
["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
["COUNT", <subscription_id>, {"count": 5}]
# Count posts approximately
["COUNT", <subscription_id>, {"kinds": [1]}]
["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}]
```