lbcd/claimtrie/node/claim_list.go
Roy Lee 6828cf5e36 [lbry] claimtrie: import current snapshot
Sync to tip

Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00

33 lines
524 B
Go

package node
import (
"github.com/lbryio/lbcd/claimtrie/change"
"github.com/lbryio/lbcd/wire"
)
type ClaimList []*Claim
type comparator func(c *Claim) bool
func byID(id change.ClaimID) comparator {
return func(c *Claim) bool {
return c.ClaimID == id
}
}
func byOut(out wire.OutPoint) comparator {
return func(c *Claim) bool {
return c.OutPoint == out // assuming value comparison
}
}
func (l ClaimList) find(cmp comparator) *Claim {
for i := range l {
if cmp(l[i]) {
return l[i]
}
}
return nil
}