diff options
Diffstat (limited to 'catchup/service.go')
-rw-r--r-- | catchup/service.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/catchup/service.go b/catchup/service.go index 27ce957ba..de4a52a94 100644 --- a/catchup/service.go +++ b/catchup/service.go @@ -241,8 +241,10 @@ func (s *Service) fetchAndWrite(r basics.Round, prevFetchCompleteChan chan bool, if err != nil { if err == errLedgerAlreadyHasBlock { - // ledger already has the block, no need to request this block from anyone. - return true + // ledger already has the block, no need to request this block. + // only the agreement could have added this block into the ledger, catchup is complete + s.log.Infof("fetchAndWrite(%d): the block is already in the ledger. The catchup is complete", r) + return false } s.log.Debugf("fetchAndWrite(%v): Could not fetch: %v (attempt %d)", r, err, i) peerSelector.rankPeer(psp, peerRankDownloadFailed) @@ -353,8 +355,10 @@ func (s *Service) fetchAndWrite(r basics.Round, prevFetchCompleteChan chan bool, s.log.Infof("fetchAndWrite(%d): no need to re-evaluate historical block", r) return true case ledgercore.BlockInLedgerError: - s.log.Infof("fetchAndWrite(%d): block already in ledger", r) - return true + // the block was added to the ledger from elsewhere after fetching it here + // only the agreement could have added this block into the ledger, catchup is complete + s.log.Infof("fetchAndWrite(%d): after fetching the block, it is already in the ledger. The catchup is complete", r) + return false case protocol.Error: if !s.protocolErrorLogged { logging.Base().Errorf("fetchAndWrite(%v): unrecoverable protocol error detected: %v", r, err) @@ -387,7 +391,7 @@ func (s *Service) pipelineCallback(r basics.Round, thisFetchComplete chan bool, thisFetchComplete <- fetchResult if !fetchResult { - s.log.Infof("failed to fetch block %v", r) + s.log.Infof("pipelineCallback(%d): did not fetch or write the block", r) return 0 } return r |