From 3fd4909cd10c0390cddc77aeb42bc9420264836e Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Tue, 31 Mar 2020 04:30:02 +0200 Subject: [PATCH] replace support abandon with txo_spend upgrade lbry.go library upgrade lbrynet support possibly introduce new bugs ;) --- e2e/docker-compose.yml | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- manager/transfer.go | 21 +++++++++++++++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index c913971..8f2782c 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -21,7 +21,7 @@ services: ## Wallet Server ## ################### walletserver: - image: lbry/wallet-server:v0.60.0 + image: lbry/wallet-server:v0.67.0 restart: always environment: - DB_DIRECTORY=/database @@ -47,7 +47,7 @@ services: ## Lbrynet ## ############# lbrynet: - image: lbry/lbrynet:v0.60.0 + image: lbry/lbrynet:v0.67.0 restart: always ports: - "15100:5279" diff --git a/go.mod b/go.mod index 7b1cee3..4e6b22f 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/hashicorp/golang-lru v0.5.3 // indirect github.com/hashicorp/memberlist v0.1.5 // indirect github.com/hashicorp/serf v0.8.5 // indirect - github.com/lbryio/lbry.go/v2 v2.4.7-0.20200204053243-1a30fb743b88 + github.com/lbryio/lbry.go/v2 v2.5.1 github.com/lbryio/reflector.go v1.0.6-0.20190828131602-ce3d4403dbc6 github.com/miekg/dns v1.1.22 // indirect github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b diff --git a/go.sum b/go.sum index f2f1261..342f994 100644 --- a/go.sum +++ b/go.sum @@ -188,8 +188,8 @@ github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c/go.mod h1:muH7wpU github.com/lbryio/lbry.go v0.0.0-20190828131228-f3a1fbdd5303/go.mod h1:qR+Ui0hYhemIU4fXqM3d1P9eiaRFlof777VJgV7KJ8w= github.com/lbryio/lbry.go v1.1.2 h1:Dyxc+glT/rVWJwHfIf7vjlPYYbjzrQz5ARmJd5Hp69c= github.com/lbryio/lbry.go v1.1.2/go.mod h1:JtyI30bU51rm0LZ/po3mQuzf++14OWb6kR/6mMRAmKU= -github.com/lbryio/lbry.go/v2 v2.4.7-0.20200204053243-1a30fb743b88 h1:SOn28lm4Bd8RY63hFVyt0d6SAD9OtFMEJVaKrO+pc/E= -github.com/lbryio/lbry.go/v2 v2.4.7-0.20200204053243-1a30fb743b88/go.mod h1:LgFKEpZzJE72DVgSXXfg+2IGOhrC9Lzj6eLma18iNz8= +github.com/lbryio/lbry.go/v2 v2.5.1 h1:Rb3BbvXKhtpTsXizCGqtCBHt/e5vDUuMNkzALfql03U= +github.com/lbryio/lbry.go/v2 v2.5.1/go.mod h1:LgFKEpZzJE72DVgSXXfg+2IGOhrC9Lzj6eLma18iNz8= github.com/lbryio/lbrycrd.go v0.0.0-20200203050410-e1076f12bf19 h1:/zWD8dVIl7bV1TdJWqPqy9tpqixzX2Qxgit48h3hQcY= github.com/lbryio/lbrycrd.go v0.0.0-20200203050410-e1076f12bf19/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/lbryio/lbryschema.go v0.0.0-20190428231007-c54836bca002/go.mod h1:dAzPCBj3CKKWBGYBZxK6tKBP5SCgY2tqd9SnQd/OyKo= diff --git a/manager/transfer.go b/manager/transfer.go index f16fe80..8c2957f 100644 --- a/manager/transfer.go +++ b/manager/transfer.go @@ -91,16 +91,17 @@ func abandonSupports(s *Sync) (float64, error) { consumerWG.Add(1) go func() { defer consumerWG.Done() + outer: for { claimID, more := <-claimIDChan if !more { return } else { - summary, err := s.daemon.SupportAbandon(&claimID, nil, nil, nil, &defaultAccount) + summary, err := s.daemon.TxoSpend(util.PtrToString("support"), &claimID, nil, nil, nil, &defaultAccount) if err != nil { if strings.Contains(err.Error(), "Client.Timeout exceeded while awaiting headers") { log.Errorf("Support abandon for %s timed out, retrying...", claimID) - summary, err = s.daemon.SupportAbandon(&claimID, nil, nil, nil, &defaultAccount) + summary, err = s.daemon.TxoSpend(util.PtrToString("support"), &claimID, nil, nil, nil, &defaultAccount) if err != nil { //TODO GUESS HOW MUCH LBC WAS RELEASED THAT WE DON'T KNOW ABOUT, because screw you SDK abandonRspChan <- abandonResponse{ @@ -119,7 +120,7 @@ func abandonSupports(s *Sync) (float64, error) { continue } } - if len(summary.Outputs) < 1 { + if summary == nil || len(*summary) < 1 { abandonRspChan <- abandonResponse{ ClaimID: claimID, Error: errors.Err("error abandoning supports: no outputs while abandoning %s", claimID), @@ -127,7 +128,19 @@ func abandonSupports(s *Sync) (float64, error) { } continue } - outputAmount, err := strconv.ParseFloat(summary.Outputs[0].Amount, 64) + var outputAmount float64 + for _, tx := range *summary { + amount, err := strconv.ParseFloat(tx.Outputs[0].Amount, 64) + if err != nil { + abandonRspChan <- abandonResponse{ + ClaimID: claimID, + Error: errors.Err(err), + Amount: 0, + } + continue outer + } + outputAmount += amount + } if err != nil { abandonRspChan <- abandonResponse{ ClaimID: claimID,