mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-26 21:51:10 +02:00
deprecate all useless tag methods, implement Find() and friends.
This commit is contained in:
@@ -24,9 +24,9 @@ var (
|
||||
// if the target is bigger than the actual difficulty then it returns 0.
|
||||
func CommittedDifficulty(event *nostr.Event) int {
|
||||
work := 0
|
||||
if nonceTag := event.Tags.GetFirst([]string{"nonce", ""}); nonceTag != nil && len(*nonceTag) >= 3 {
|
||||
if nonceTag := event.Tags.Find("nonce"); nonceTag != nil && len(nonceTag) >= 3 {
|
||||
work = Difficulty(event.ID)
|
||||
target, _ := strconv.Atoi((*nonceTag)[2])
|
||||
target, _ := strconv.Atoi(nonceTag[2])
|
||||
if target <= work {
|
||||
work = target
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user