From f3f40c41ef9ab68de432b6a620d169ddaf595064 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sat, 22 Jun 2019 06:08:11 -0400 Subject: [PATCH] fix refill balance --- manager/setup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manager/setup.go b/manager/setup.go index 7bc272c..07480bc 100644 --- a/manager/setup.go +++ b/manager/setup.go @@ -90,12 +90,12 @@ func (s *Sync) walletSetup() error { } s.syncedVideosMux.RUnlock() - log.Debugf("We already allocated credits for %d videos", publishedCount) + log.Debugf("We already allocated credits for %d published videos and %d failed videos", publishedCount, failedCount) if videosOnYoutube > s.Manager.videosLimit { videosOnYoutube = s.Manager.videosLimit } - unallocatedVideos := videosOnYoutube - publishedCount + unallocatedVideos := videosOnYoutube - (publishedCount + failedCount) requiredBalance := float64(unallocatedVideos)*(publishAmount+estimatedMaxTxFee) + channelClaimAmount if s.Manager.upgradeMetadata { requiredBalance += float64(notUpgradedCount) * 0.001 @@ -103,7 +103,7 @@ func (s *Sync) walletSetup() error { refillAmount := 0.0 if balance < requiredBalance || balance < minimumAccountBalance { - refillAmount = math.Max(requiredBalance-requiredBalance, minimumRefillAmount) + refillAmount = math.Max(requiredBalance-balance, minimumRefillAmount) } if s.Refill > 0 {