change utxos confirmation behavior

should make startup faster
bug fixes
This commit is contained in:
Niko Storni 2018-08-03 13:50:17 -04:00
parent 24aca302ff
commit 143f19c59e
2 changed files with 8 additions and 10 deletions

View file

@ -256,7 +256,7 @@ func (s SyncManager) Start() error {
time.Sleep(5 * time.Minute)
}
for i, sync := range syncs {
SendInfoToSlack("Syncing %s to LBRY! (iteration %d/%d - total session iterations: %d)", sync.LbryChannelName, i, len(syncs), syncCount)
SendInfoToSlack("Syncing %s to LBRY! (iteration %d/%d - total session iterations: %d)", sync.LbryChannelName, i+1, len(syncs), syncCount)
err := sync.FullCycle()
if err != nil {
fatalErrors := []string{

View file

@ -55,7 +55,7 @@ func (s *Sync) walletSetup() error {
//TODO: get rid of this as soon as we compute this condition using the database in a more reliable way
if numPublished >= numOnSource {
return errors.Err("channel is already up to date")
return nil
}
minBalance := (float64(numOnSource)-float64(numPublished))*(publishAmount+0.1) + channelClaimAmount
if numPublished > numOnSource {
@ -107,14 +107,6 @@ func (s *Sync) ensureEnoughUTXOs() error {
return errors.Err("no response")
}
if !allUTXOsConfirmed(utxolist) {
log.Println("Waiting for previous txns to confirm") // happens if you restarted the daemon soon after a previous publish run
err := s.waitUntilUTXOsConfirmed()
if err != nil {
return err
}
}
target := 40
count := 0
@ -154,6 +146,12 @@ func (s *Sync) ensureEnoughUTXOs() error {
if err != nil {
return err
}
} else if !allUTXOsConfirmed(utxolist) {
log.Println("Waiting for previous txns to confirm")
err := s.waitUntilUTXOsConfirmed()
if err != nil {
return err
}
}
return nil