resolve issue with channels attempting re-transfer

This commit is contained in:
Niko Storni 2019-10-08 14:42:57 +02:00
parent ad1704fb39
commit 65daeec216

View file

@ -148,16 +148,26 @@ func transferVideos(s *Sync) error {
} }
func transferChannel(s *Sync) error { func transferChannel(s *Sync) error {
channelClaim, err := s.daemon.ClaimSearch(nil, &s.lbryChannelID, nil, nil) account, err := s.getDefaultAccount()
if err != nil {
return err
}
channelClaims, err := s.daemon.ChannelList(&account, 1, 50)
if err != nil { if err != nil {
return errors.Err(err) return errors.Err(err)
} }
if channelClaim == nil || len(channelClaim.Claims) == 0 { var channelClaim *jsonrpc.Transaction = nil
return errors.Err("There is no channel claim for channel %s", s.LbryChannelName) for _, c := range channelClaims.Items {
if c.ClaimID != s.lbryChannelID {
continue
} }
if channelClaim.Claims[0].Address == s.clientPublishAddress { channelClaim = &c
break
}
if channelClaim == nil {
return nil return nil
} }
updateOptions := jsonrpc.ChannelUpdateOptions{ updateOptions := jsonrpc.ChannelUpdateOptions{
Bid: util.PtrToString(fmt.Sprintf("%.6f", channelClaimAmount-0.005)), Bid: util.PtrToString(fmt.Sprintf("%.6f", channelClaimAmount-0.005)),
ChannelCreateOptions: jsonrpc.ChannelCreateOptions{ ChannelCreateOptions: jsonrpc.ChannelCreateOptions{