Skip to content

Commit

Permalink
fix event kind range helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Sep 19, 2024
1 parent f94199c commit c07528e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,21 @@ func (evt *Event) Sign(privateKey string, signOpts ...schnorr.SignOption) error

// IsRegular checks if the given kind is in Regular range.
func (evt *Event) IsRegular() bool {
return 1000 <= evt.Kind || evt.Kind < 10000 || 4 <= evt.Kind ||
evt.Kind < 45 || evt.Kind == 1 || evt.Kind == 2
return evt.Kind < 10000 && evt.Kind != 0 && evt.Kind != 3
}

// IsReplaceable checks if the given kind is in Replaceable range.
func (evt *Event) IsReplaceable() bool {
return 10000 <= evt.Kind || evt.Kind < 20000 ||
evt.Kind == 0 || evt.Kind == 3
return evt.Kind == 0 || evt.Kind == 3 ||
(10000 <= evt.Kind && evt.Kind < 20000)
}

// IsEphemeral checks if the given kind is in Ephemeral range.
func (evt *Event) IsEphemeral() bool {
return 20000 <= evt.Kind || evt.Kind < 30000
return 20000 <= evt.Kind && evt.Kind < 30000
}

// IsParameterizedReplaceable checks if the given kind is in ParameterizedReplaceable range.
func (evt *Event) IsParameterizedReplaceable() bool {
return 30000 <= evt.Kind || evt.Kind < 40000
// IsAddressable checks if the given kind is in Addressable range.
func (evt *Event) IsAddressable() bool {
return 30000 <= evt.Kind && evt.Kind < 40000
}

0 comments on commit c07528e

Please sign in to comment.