From 93f9185c71ee819275d73d2db0926fa132ca5873 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sat, 11 Jan 2020 22:01:40 -0500 Subject: [PATCH] fix bug when publishing --- manager/transfer.go | 7 ++++++- manager/ytsync.go | 8 +++++++- sources/youtubeVideo.go | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/manager/transfer.go b/manager/transfer.go index 08a5c41..f16fe80 100644 --- a/manager/transfer.go +++ b/manager/transfer.go @@ -204,7 +204,12 @@ func transferVideos(s *Sync) error { streamUpdateOptions := jsonrpc.StreamUpdateOptions{ StreamCreateOptions: &jsonrpc.StreamCreateOptions{ - ClaimCreateOptions: jsonrpc.ClaimCreateOptions{ClaimAddress: &s.clientPublishAddress}, + ClaimCreateOptions: jsonrpc.ClaimCreateOptions{ + ClaimAddress: &s.clientPublishAddress, + FundingAccountIDs: []string{ + account, + }, + }, }, Bid: util.PtrToString("0.005"), // Todo - Dont hardcode } diff --git a/manager/ytsync.go b/manager/ytsync.go index a13bcc8..8720676 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -660,7 +660,8 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim, ownClaims []jsonrpc.Claim) log.Debugf("%s: was transferred but appears abandoned! we should ignore this - claimID: %s", vID, sv.ClaimID) continue //TODO: we should flag these on the db } else { - return count, fixed, 0, errors.Err("%s: isn't our control but is on the database and on the blockchain. wtf is up? ClaimID: %s", vID, sv.ClaimID) + log.Debugf("%s: was transferred adn was then edited! we should ignore this - claimID: %s", vID, sv.ClaimID) + //return count, fixed, 0, errors.Err("%s: isn't our control but is on the database and on the blockchain. wtf is up? ClaimID: %s", vID, sv.ClaimID) } } continue @@ -1143,6 +1144,10 @@ func (s *Sync) processVideo(v video) (err error) { if err != nil { return err } + da, err := s.getDefaultAccount() + if err != nil { + return err + } sp := sources.SyncParams{ ClaimAddress: s.claimAddress, Amount: publishAmount, @@ -1151,6 +1156,7 @@ func (s *Sync) processVideo(v video) (err error) { Namer: s.namer, MaxVideoLength: s.Manager.maxVideoLength, Fee: s.Fee, + DefaultAccount: da, } summary, err := v.Sync(s.daemon, sp, &sv, videoRequiresUpgrade, s.walletMux) diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 9992e92..cee2d05 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -367,7 +367,6 @@ func (v *YoutubeVideo) triggerThumbnailSave() (err error) { func (v *YoutubeVideo) publish(daemon *jsonrpc.Client, params SyncParams) (*SyncSummary, error) { languages, locations, tags := v.getMetadata() - var fee *jsonrpc.Fee if params.Fee != nil { feeAmount, err := decimal.NewFromString(params.Fee.Amount) @@ -390,6 +389,9 @@ func (v *YoutubeVideo) publish(daemon *jsonrpc.Client, params SyncParams) (*Sync ThumbnailURL: &v.thumbnailURL, Tags: tags, Locations: locations, + FundingAccountIDs: []string{ + params.DefaultAccount, + }, }, Fee: fee, License: util.PtrToString("Copyrighted (contact publisher)"), @@ -415,6 +417,7 @@ type SyncParams struct { Namer *namer.Namer MaxVideoLength float64 Fee *sdk.Fee + DefaultAccount string } func (v *YoutubeVideo) Sync(daemon *jsonrpc.Client, params SyncParams, existingVideoData *sdk.SyncedVideo, reprocess bool, walletLock *sync.RWMutex) (*SyncSummary, error) { @@ -548,6 +551,9 @@ func (v *YoutubeVideo) reprocess(daemon *jsonrpc.Client, params SyncParams, exis ThumbnailURL: &thumbnailURL, Languages: languages, Locations: locations, + FundingAccountIDs: []string{ + params.DefaultAccount, + }, }, Author: util.PtrToString(""), License: util.PtrToString("Copyrighted (contact publisher)"),