fix bug with non-related publishes

This commit is contained in:
Niko Storni 2019-12-14 06:43:01 +01:00
parent 62dfdc1adb
commit 5df6db6e96

View file

@ -467,7 +467,7 @@ var thumbnailHosts = []string{
thumbs.ThumbnailEndpoint, thumbs.ThumbnailEndpoint,
} }
func isYtsyncClaim(c jsonrpc.Claim) bool { func isYtsyncClaim(c jsonrpc.Claim, expectedChannelID string) bool {
if !util.InSlice(c.Type, []string{"claim", "update"}) || c.Value.GetStream() == nil { if !util.InSlice(c.Type, []string{"claim", "update"}) || c.Value.GetStream() == nil {
return false return false
} }
@ -475,7 +475,12 @@ func isYtsyncClaim(c jsonrpc.Claim) bool {
//most likely a claim created outside of ytsync, ignore! //most likely a claim created outside of ytsync, ignore!
return false return false
} }
if c.SigningChannel == nil {
return false
}
if c.SigningChannel.ClaimID != expectedChannelID {
return false
}
for _, th := range thumbnailHosts { for _, th := range thumbnailHosts {
if strings.Contains(c.Value.GetThumbnail().GetUrl(), th) { if strings.Contains(c.Value.GetThumbnail().GetUrl(), th) {
return true return true
@ -489,7 +494,7 @@ func (s *Sync) fixDupes(claims []jsonrpc.Claim) (bool, error) {
abandonedClaims := false abandonedClaims := false
videoIDs := make(map[string]jsonrpc.Claim) videoIDs := make(map[string]jsonrpc.Claim)
for _, c := range claims { for _, c := range claims {
if !isYtsyncClaim(c) { if !isYtsyncClaim(c, s.lbryChannelID) {
continue continue
} }
tn := c.Value.GetThumbnail().GetUrl() tn := c.Value.GetThumbnail().GetUrl()
@ -536,7 +541,7 @@ type ytsyncClaim struct {
func (s *Sync) mapFromClaims(claims []jsonrpc.Claim) map[string]ytsyncClaim { func (s *Sync) mapFromClaims(claims []jsonrpc.Claim) map[string]ytsyncClaim {
videoIDMap := make(map[string]ytsyncClaim, len(claims)) videoIDMap := make(map[string]ytsyncClaim, len(claims))
for _, c := range claims { for _, c := range claims {
if !isYtsyncClaim(c) { if !isYtsyncClaim(c, s.lbryChannelID) {
continue continue
} }
tn := c.Value.GetThumbnail().GetUrl() tn := c.Value.GetThumbnail().GetUrl()