sdk/hints: use a single "hint" type instead of nprofile/nevent/tag/nip05.

This commit is contained in:
fiatjaf
2025-01-18 18:19:54 -03:00
parent 6cffcc3b47
commit 40538486d5
6 changed files with 24 additions and 50 deletions

View File

@@ -10,20 +10,14 @@ const (
LastFetchAttempt HintKey = iota
MostRecentEventFetched
LastInRelayList
LastInTag
LastInNprofile
LastInNevent
LastInNIP05
LastInHint
)
var KeyBasePoints = [7]int64{
var KeyBasePoints = [4]int64{
-500, // attempting has negative power because it may fail
700, // when it succeeds that should cancel the negative effect of trying
350, // a relay list is a very strong indicator
5, // tag hints are often autogenerated so we don't care very much about them (that may change)
22, // it feels like people take nprofiles slightly more seriously so we value these a bit more
8, // these are also not often too bad
7, // nip05 hints should be a strong indicator, although in practice they're kinda bad
20, // hints from various sources (tags, nprofile, nevent, nip05)
}
func (hk HintKey) BasePoints() int64 { return KeyBasePoints[hk] }
@@ -36,14 +30,8 @@ func (hk HintKey) String() string {
return "most_recent_event_fetched"
case LastInRelayList:
return "last_in_relay_list"
case LastInTag:
return "last_in_tag"
case LastInNprofile:
return "last_in_nprofile"
case LastInNevent:
return "last_in_nevent"
case LastInNIP05:
return "last_in_nip05"
case LastInHint:
return "last_in_hint"
}
return "<unexpected>"
}