add flag to manually refill credits into sync wallet
This commit is contained in:
parent
daffded4f0
commit
b572c39dd0
2 changed files with 12 additions and 3 deletions
12
setup.go
12
setup.go
|
@ -46,11 +46,19 @@ func (s *Sync) walletSetup() error {
|
|||
|
||||
minBalance := (float64(numOnSource)-float64(numPublished))*publishAmount + channelClaimAmount
|
||||
amountToAdd, _ := decimal.NewFromFloat(minBalance).Sub(balance).Float64()
|
||||
amountToAdd *= 1.5 // add 50% margin for fees, future publishes, etc
|
||||
|
||||
if s.Refill > 0 {
|
||||
if amountToAdd < 0 {
|
||||
amountToAdd = float64(s.Refill)
|
||||
} else {
|
||||
amountToAdd += float64(s.Refill)
|
||||
}
|
||||
}
|
||||
|
||||
if amountToAdd > 0 {
|
||||
amountToAdd *= 1.5 // add 50% margin for fees, future publishes, etc
|
||||
if amountToAdd < 1 {
|
||||
amountToAdd = 1
|
||||
amountToAdd = 1 // no reason to bother adding less than 1 credit
|
||||
}
|
||||
s.addCredits(amountToAdd)
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ type Sync struct {
|
|||
MaxTries int
|
||||
ConcurrentVideos int
|
||||
TakeOverExistingChannel bool
|
||||
Refill int
|
||||
|
||||
daemon *jsonrpc.Client
|
||||
claimAddress string
|
||||
|
@ -123,7 +124,7 @@ func (s *Sync) FullCycle() error {
|
|||
signal.Notify(interruptChan, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-interruptChan
|
||||
log.Println("Got interrupt signal. Will shut down after current publishes finish")
|
||||
log.Println("Got interrupt signal, shutting down (if publishing, will shut down after current publish)")
|
||||
s.stop.Stop()
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in a new issue