fix nil ptr dereference
fix bug in transfers
This commit is contained in:
parent
a9e76149e8
commit
10a855a8ba
2 changed files with 9 additions and 7 deletions
|
@ -108,7 +108,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
||||||
Error: err,
|
Error: err,
|
||||||
Amount: 0, // this is likely wrong, but oh well... there is literally nothing I can do about it
|
Amount: 0, // this is likely wrong, but oh well... there is literally nothing I can do about it
|
||||||
}
|
}
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
abandonRspChan <- abandonResponse{
|
abandonRspChan <- abandonResponse{
|
||||||
|
@ -116,7 +116,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
||||||
Error: err,
|
Error: err,
|
||||||
Amount: 0,
|
Amount: 0,
|
||||||
}
|
}
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(summary.Outputs) < 1 {
|
if len(summary.Outputs) < 1 {
|
||||||
|
@ -125,7 +125,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
||||||
Error: errors.Err("error abandoning supports: no outputs while abandoning %s", claimID),
|
Error: errors.Err("error abandoning supports: no outputs while abandoning %s", claimID),
|
||||||
Amount: 0,
|
Amount: 0,
|
||||||
}
|
}
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
outputAmount, err := strconv.ParseFloat(summary.Outputs[0].Amount, 64)
|
outputAmount, err := strconv.ParseFloat(summary.Outputs[0].Amount, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -134,7 +134,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
||||||
Error: errors.Err(err),
|
Error: errors.Err(err),
|
||||||
Amount: 0,
|
Amount: 0,
|
||||||
}
|
}
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
log.Infof("Abandoned supports of %.4f LBC for claim %s", outputAmount, claimID)
|
log.Infof("Abandoned supports of %.4f LBC for claim %s", outputAmount, claimID)
|
||||||
abandonRspChan <- abandonResponse{
|
abandonRspChan <- abandonResponse{
|
||||||
|
@ -142,7 +142,7 @@ func abandonSupports(s *Sync) (float64, error) {
|
||||||
Error: nil,
|
Error: nil,
|
||||||
Amount: outputAmount,
|
Amount: outputAmount,
|
||||||
}
|
}
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -124,12 +124,14 @@ func (a *APIConfig) SetChannelCert(certHex string, channelID string) error {
|
||||||
|
|
||||||
endpoint := a.ApiURL + "/yt/channel_cert"
|
endpoint := a.ApiURL + "/yt/channel_cert"
|
||||||
|
|
||||||
res, _ := http.PostForm(endpoint, url.Values{
|
res, err := http.PostForm(endpoint, url.Values{
|
||||||
"channel_claim_id": {channelID},
|
"channel_claim_id": {channelID},
|
||||||
"channel_cert": {certHex},
|
"channel_cert": {certHex},
|
||||||
"auth_token": {a.ApiToken},
|
"auth_token": {a.ApiToken},
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return errors.Err(err)
|
||||||
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
body, _ := ioutil.ReadAll(res.Body)
|
body, _ := ioutil.ReadAll(res.Body)
|
||||||
|
|
Loading…
Reference in a new issue