fix bug where newly published and transferred videos caused an error
rename variable for better clarity
This commit is contained in:
parent
5171acc007
commit
44e6cb5ddc
4 changed files with 73 additions and 70 deletions
|
@ -141,7 +141,7 @@ func (s *SyncManager) Start() error {
|
|||
AwsS3Bucket: s.awsS3Bucket,
|
||||
namer: namer.NewNamer(),
|
||||
Fee: channels[0].Fee,
|
||||
publishAddress: channels[0].PublishAddress,
|
||||
clientPublishAddress: channels[0].PublishAddress,
|
||||
publicKey: channels[0].PublicKey,
|
||||
transferState: channels[0].TransferState,
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ func (s *SyncManager) Start() error {
|
|||
AwsS3Bucket: s.awsS3Bucket,
|
||||
namer: namer.NewNamer(),
|
||||
Fee: c.Fee,
|
||||
publishAddress: c.PublishAddress,
|
||||
clientPublishAddress: c.PublishAddress,
|
||||
publicKey: c.PublicKey,
|
||||
transferState: c.TransferState,
|
||||
})
|
||||
|
|
|
@ -131,7 +131,7 @@ func (s *Sync) walletSetup() error {
|
|||
return errors.Err("found blank claim address")
|
||||
}
|
||||
if s.shouldTransfer() {
|
||||
s.claimAddress = s.publishAddress
|
||||
s.claimAddress = s.clientPublishAddress
|
||||
}
|
||||
|
||||
err = s.ensureEnoughUTXOs()
|
||||
|
|
|
@ -61,7 +61,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
|||
if ok {
|
||||
continue
|
||||
}
|
||||
supportOnTransferredClaim := support.Address == s.publishAddress //todo: probably not needed anymore
|
||||
supportOnTransferredClaim := support.Address == s.clientPublishAddress //todo: probably not needed anymore
|
||||
if supportOnTransferredClaim {
|
||||
continue
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func transferVideos(s *Sync) error {
|
|||
cleanTransfer := true
|
||||
for _, video := range s.syncedVideos {
|
||||
if !video.Published || video.Transferred || video.MetadataVersion != LatestMetadataVersion {
|
||||
log.Debugf("skipping video: %s", video.VideoID)
|
||||
//log.Debugf("skipping video: %s", video.VideoID)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,12 @@ func transferVideos(s *Sync) error {
|
|||
return errors.Err("cannot transfer: too many claims. claimID: %s", video.ClaimID)
|
||||
}
|
||||
|
||||
if c.Claims[0].Address == s.clientPublishAddress {
|
||||
continue
|
||||
}
|
||||
streamUpdateOptions := jsonrpc.StreamUpdateOptions{
|
||||
StreamCreateOptions: &jsonrpc.StreamCreateOptions{
|
||||
ClaimCreateOptions: jsonrpc.ClaimCreateOptions{ClaimAddress: &s.publishAddress},
|
||||
ClaimCreateOptions: jsonrpc.ClaimCreateOptions{ClaimAddress: &s.clientPublishAddress},
|
||||
},
|
||||
Bid: util.PtrToString("0.005"), // Todo - Dont hardcode
|
||||
}
|
||||
|
@ -152,14 +155,14 @@ func transferChannel(s *Sync) error {
|
|||
if channelClaim == nil || len(channelClaim.Claims) == 0 {
|
||||
return errors.Err("There is no channel claim for channel %s", s.LbryChannelName)
|
||||
}
|
||||
if channelClaim.Claims[0].Address == s.publishAddress {
|
||||
if channelClaim.Claims[0].Address == s.clientPublishAddress {
|
||||
return nil
|
||||
}
|
||||
updateOptions := jsonrpc.ChannelUpdateOptions{
|
||||
Bid: util.PtrToString(fmt.Sprintf("%.6f", channelClaimAmount-0.005)),
|
||||
ChannelCreateOptions: jsonrpc.ChannelCreateOptions{
|
||||
ClaimCreateOptions: jsonrpc.ClaimCreateOptions{
|
||||
ClaimAddress: &s.publishAddress,
|
||||
ClaimAddress: &s.clientPublishAddress,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ type Sync struct {
|
|||
walletMux *sync.RWMutex
|
||||
queue chan video
|
||||
transferState int
|
||||
publishAddress string
|
||||
clientPublishAddress string
|
||||
publicKey string
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ func deleteSyncFolder(videoDirectory string) {
|
|||
}
|
||||
|
||||
func (s *Sync) shouldTransfer() bool {
|
||||
return s.transferState >= 1 && s.publishAddress != "" && !s.Manager.SyncFlags.DisableTransfers
|
||||
return s.transferState >= 1 && s.clientPublishAddress != "" && !s.Manager.SyncFlags.DisableTransfers
|
||||
}
|
||||
|
||||
func (s *Sync) setChannelTerminationStatus(e *error) {
|
||||
|
@ -505,7 +505,7 @@ func (s *Sync) fixDupes(claims []jsonrpc.Claim) (bool, error) {
|
|||
claimToAbandon = cl
|
||||
videoIDs[videoID] = c
|
||||
}
|
||||
if claimToAbandon.Address != s.publishAddress && !s.syncedVideos[videoID].Transferred {
|
||||
if claimToAbandon.Address != s.clientPublishAddress && !s.syncedVideos[videoID].Transferred {
|
||||
log.Debugf("abandoning %+v", claimToAbandon)
|
||||
_, err := s.daemon.StreamAbandon(claimToAbandon.Txid, claimToAbandon.Nout, nil, false)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue