From fc575dac80809a810a785ba2ca8a595551389321 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sun, 8 Dec 2019 10:31:15 -0500 Subject: [PATCH] improve logging fix ipv6 switching --- ip_manager/throttle.go | 2 +- manager/setup.go | 4 ++++ manager/ytsync.go | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ip_manager/throttle.go b/ip_manager/throttle.go index cfb73f5..173f37d 100644 --- a/ip_manager/throttle.go +++ b/ip_manager/throttle.go @@ -37,7 +37,7 @@ func GetNextIP(ipv6 bool) (string, error) { } for _, address := range addrs { - if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { + if ipnet, ok := address.(*net.IPNet); ok && ipnet.IP.IsGlobalUnicast() { if ipnet.IP.To16() != nil && govalidator.IsIPv6(ipnet.IP.String()) { ipv6Pool = append(ipv6Pool, ipnet.IP.String()) ipLastUsed[ipnet.IP.String()] = time.Now().Add(-IPCooldownPeriod) diff --git a/manager/setup.go b/manager/setup.go index f33fb6f..ce020b2 100644 --- a/manager/setup.go +++ b/manager/setup.go @@ -240,12 +240,16 @@ func (s *Sync) ensureEnoughUTXOs() error { } func (s *Sync) waitForNewBlock() error { + log.Printf("regtest: %t, docker: %t", logUtils.IsRegTest(), logUtils.IsUsingDocker()) if logUtils.IsRegTest() && logUtils.IsUsingDocker() { lbrycrd, err := logUtils.GetLbrycrdClient(s.LbrycrdString) if err != nil { return errors.Prefix("error getting lbrycrd client: ", err) } txs, err := lbrycrd.Generate(1) + if err != nil { + return errors.Prefix("error generating new block: ", err) + } for _, tx := range txs { log.Info("Generated tx: ", tx.String()) } diff --git a/manager/ytsync.go b/manager/ytsync.go index 00b1f1b..4d3f5ee 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -333,7 +333,7 @@ func (s *Sync) processTransfers() (e error) { return errors.Prefix(fmt.Sprintf("%.6f LBCs were abandoned before failing", supportAmount), err) } if supportAmount > 0 { - logUtils.SendInfoToSlack("%.6f LBCs were abandoned and should be used as support", supportAmount) + logUtils.SendInfoToSlack("(%s) %.6f LBCs were abandoned and should be used as support", s.YoutubeChannelID, supportAmount) } err = transferVideos(s) if err != nil { @@ -1192,7 +1192,7 @@ func (s *Sync) getUnsentSupports() (float64, error) { } } if balanceAmount > 10 && sentSupports < 1 { - logUtils.SendErrorToSlack("this channel has quite some LBCs in it (%.2f) and %.2f LBC in sent tips, it's likely that the tips weren't actually sent or the wallet has unnecessary extra credits in it", balanceAmount, sentSupports) + logUtils.SendErrorToSlack("(%s) this channel has quite some LBCs in it (%.2f) and %.2f LBC in sent tips, it's likely that the tips weren't actually sent or the wallet has unnecessary extra credits in it", s.YoutubeChannelID, balanceAmount, sentSupports) return balanceAmount - 10, nil } }