fix transfer bugs

This commit is contained in:
Niko Storni 2019-09-27 16:10:57 +02:00
parent 7ce4c4a2ce
commit c41c368f34
3 changed files with 13 additions and 6 deletions

2
go.mod
View file

@ -12,7 +12,7 @@ require (
github.com/docker/go-units v0.4.0 // indirect
github.com/go-ini/ini v1.41.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/lbryio/lbry.go v0.0.0-20190924183703-712e346bd209
github.com/lbryio/lbry.go v0.0.0-20190927133623-deab868c53ce
github.com/lbryio/reflector.go v1.0.6-0.20190828131602-ce3d4403dbc6
github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
github.com/mitchellh/mapstructure v1.1.2 // indirect

4
go.sum
View file

@ -159,8 +159,8 @@ github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c h1:BhdcWGsuKif/Xo
github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c/go.mod h1:muH7wpUqE8hRA3OrYYosw9+Sl681BF9cwcjzE+OCNK8=
github.com/lbryio/lbry.go v0.0.0-20190828131228-f3a1fbdd5303 h1:CyDDxUMREhAxPlgP+mgcArgkGJKtdXssj7CXk7o3h84=
github.com/lbryio/lbry.go v0.0.0-20190828131228-f3a1fbdd5303/go.mod h1:qR+Ui0hYhemIU4fXqM3d1P9eiaRFlof777VJgV7KJ8w=
github.com/lbryio/lbry.go v0.0.0-20190924183703-712e346bd209 h1:idtWts2fhF8TiGK4W+REJtrj5r6EeXr8+77g/nz8snk=
github.com/lbryio/lbry.go v0.0.0-20190924183703-712e346bd209/go.mod h1:wnoiUIfkeUmbiIGR/dg3Xvb6a6Jz7vPxtUoENyyl5QE=
github.com/lbryio/lbry.go v0.0.0-20190927133623-deab868c53ce h1:+irOdGmB0h9jNgL0PSFkCcds/Y9FWXicDpxRScxkJ+k=
github.com/lbryio/lbry.go v0.0.0-20190927133623-deab868c53ce/go.mod h1:wnoiUIfkeUmbiIGR/dg3Xvb6a6Jz7vPxtUoENyyl5QE=
github.com/lbryio/lbryschema.go v0.0.0-20190602173230-6d2f69a36f46 h1:LemfR+rMxhf7nnOrzy2HqS7Me7SZ5gEwOcNFzKC8ySQ=
github.com/lbryio/lbryschema.go v0.0.0-20190602173230-6d2f69a36f46/go.mod h1:dAzPCBj3CKKWBGYBZxK6tKBP5SCgY2tqd9SnQd/OyKo=
github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04 h1:Nze+C2HbeKvhjI/kVn+9Poj/UuEW5sOQxcsxqO7L3GI=

View file

@ -1,6 +1,7 @@
package manager
import (
"fmt"
"github.com/lbryio/lbry.go/extras/errors"
"github.com/lbryio/lbry.go/extras/jsonrpc"
"github.com/lbryio/lbry.go/extras/util"
@ -115,14 +116,16 @@ func transferVideos(s *Sync) error {
videoStatus.FailureReason = updateError.Error()
videoStatus.Status = VideoStatusTranferFailed
videoStatus.IsTransferred = util.PtrToBool(false)
} else {
videoStatus.IsTransferred = util.PtrToBool(len(result.Outputs) != 0)
}
log.Infof("TRANSFERRED %t", len(result.Outputs) != 0)
log.Infof("TRANSFERRED %t", videoStatus.IsTransferred)
statusErr := s.APIConfig.MarkVideoStatus(videoStatus)
if statusErr != nil {
return errors.Err(statusErr)
return errors.Prefix(statusErr.Error(), updateError)
}
if updateError != nil {
return errors.Err(err)
return errors.Err(updateError)
}
}
// Todo - Transfer Channel as last step and post back to remote db that channel is transferred.
@ -144,6 +147,7 @@ func transferChannel(s *Sync) error {
return nil
}
updateOptions := jsonrpc.ChannelUpdateOptions{
Bid: util.PtrToString(fmt.Sprintf("%.6f", channelClaimAmount-0.001)),
ChannelCreateOptions: jsonrpc.ChannelCreateOptions{
ClaimCreateOptions: jsonrpc.ClaimCreateOptions{
ClaimAddress: &s.publishAddress,
@ -151,6 +155,9 @@ func transferChannel(s *Sync) error {
},
}
result, err := s.daemon.ChannelUpdate(s.lbryChannelID, updateOptions)
if err != nil {
return errors.Err(err)
}
log.Infof("TRANSFERRED %t", len(result.Outputs) != 0)
return errors.Err(err)