fix event kind range helpers.

This commit is contained in:
fiatjaf
2024-09-19 11:38:22 -03:00
parent f94199cfc0
commit c07528eb42

View File

@ -144,22 +144,21 @@ func (evt *Event) Sign(privateKey string, signOpts ...schnorr.SignOption) error
// IsRegular checks if the given kind is in Regular range. // IsRegular checks if the given kind is in Regular range.
func (evt *Event) IsRegular() bool { func (evt *Event) IsRegular() bool {
return 1000 <= evt.Kind || evt.Kind < 10000 || 4 <= evt.Kind || return evt.Kind < 10000 && evt.Kind != 0 && evt.Kind != 3
evt.Kind < 45 || evt.Kind == 1 || evt.Kind == 2
} }
// IsReplaceable checks if the given kind is in Replaceable range. // IsReplaceable checks if the given kind is in Replaceable range.
func (evt *Event) IsReplaceable() bool { func (evt *Event) IsReplaceable() bool {
return 10000 <= evt.Kind || evt.Kind < 20000 || return evt.Kind == 0 || evt.Kind == 3 ||
evt.Kind == 0 || evt.Kind == 3 (10000 <= evt.Kind && evt.Kind < 20000)
} }
// IsEphemeral checks if the given kind is in Ephemeral range. // IsEphemeral checks if the given kind is in Ephemeral range.
func (evt *Event) IsEphemeral() bool { 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. // IsAddressable checks if the given kind is in Addressable range.
func (evt *Event) IsParameterizedReplaceable() bool { func (evt *Event) IsAddressable() bool {
return 30000 <= evt.Kind || evt.Kind < 40000 return 30000 <= evt.Kind && evt.Kind < 40000
} }