File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 120
120
* nostr: fix ` TagStanderd::to_vec ` ([ nanikamado] )
121
121
* nostr: fix broken intra doc links ([ Yuki Kishimoto] )
122
122
* nostr: fix ` JsonUtil::try_as_pretty_json ` method ([ Yuki Kishimoto] )
123
+ * nostr: fix ` Kind::is_regular ` method ([ Yuki Kishimoto] )
123
124
124
125
### Removed
125
126
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ impl Kind {
67
67
68
68
/// Check if it's regular
69
69
///
70
+ /// Regular means that event is expected to be stored by relays.
71
+ ///
70
72
/// <https://github.com/nostr-protocol/nips/blob/master/01.md>
71
73
#[ inline]
72
74
pub fn is_regular ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ impl JsKind {
60
60
61
61
/// Check if it's regular
62
62
///
63
+ /// Regular means that event is expected to be stored by relays.
64
+ ///
63
65
/// <https://github.com/nostr-protocol/nips/blob/master/01.md>
64
66
#[ wasm_bindgen( js_name = isRegular) ]
65
67
pub fn is_regular ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ pub const PARAMETERIZED_REPLACEABLE_RANGE: Range<u16> = 30_000..40_000;
29
29
30
30
macro_rules! kind_variants {
31
31
( $( $name: ident => $value: expr, $doc: expr) ,* $( , ) ?) => {
32
- /// Event [`Kind`]
32
+ /// Event kind
33
+ ///
34
+ /// <https://github.com/nostr-protocol/nips/blob/master/01.md>
33
35
#[ derive( Debug , Clone , Copy ) ]
34
36
pub enum Kind {
35
37
$(
@@ -227,10 +229,19 @@ impl Kind {
227
229
NIP90_JOB_RESULT_RANGE . contains ( & self . as_u16 ( ) )
228
230
}
229
231
230
- /// Check if [`Kind`] is `Regular`
231
- #[ inline]
232
+ /// Check if it's regular
233
+ ///
234
+ /// Regular means that event is expected to be stored by relays.
232
235
pub fn is_regular ( & self ) -> bool {
233
- REGULAR_RANGE . contains ( & self . as_u16 ( ) )
236
+ let kind: u16 = self . as_u16 ( ) ;
237
+
238
+ // Exclude ALL param replaceable and ephemeral
239
+ // Exclude PARTIALLY the replaceable
240
+ if kind > 10_000 {
241
+ return false ;
242
+ }
243
+
244
+ REGULAR_RANGE . contains ( & kind) || !self . is_replaceable ( )
234
245
}
235
246
236
247
/// Check if [`Kind`] is `Replaceable`
You can’t perform that action at this time.
0 commit comments