Skip to content

Commit c7f741b

Browse files
committed
feat: compute hash for PaymentsStarGiftActiveAuctions
1 parent cdefc37 commit c7f741b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

telegram/query/cached/compute_hash.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,18 @@ func (s *AccountGetSavedMusicIDs) computeHash(v *tg.AccountSavedMusicIDs) int64
6464

6565
return h.Sum()
6666
}
67+
68+
func (s *PaymentsGetStarGiftActiveAuctions) computeHash(v *tg.PaymentsStarGiftActiveAuctions) int64 {
69+
auctions := v.Auctions
70+
71+
sort.SliceStable(auctions, func(i, j int) bool {
72+
return auctions[i].GetGift().GetID() < auctions[j].GetGift().GetID()
73+
})
74+
75+
h := hasher.Hasher{}
76+
for _, auction := range auctions {
77+
h.Update(uint32(auction.GetGift().GetID()))
78+
}
79+
80+
return h.Sum()
81+
}

0 commit comments

Comments
 (0)