diff options
Diffstat (limited to 'catchup/universalFetcher.go')
-rw-r--r-- | catchup/universalFetcher.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/catchup/universalFetcher.go b/catchup/universalFetcher.go index 2d4957fdb..acd51c002 100644 --- a/catchup/universalFetcher.go +++ b/catchup/universalFetcher.go @@ -64,6 +64,9 @@ func (uf *universalBlockFetcher) fetchBlock(ctx context.Context, round basics.Ro config: &uf.config, } fetchedBuf, err = fetcherClient.getBlockBytes(ctx, round) + if err != nil { + return nil, nil, time.Duration(0), err + } address = fetcherClient.address() } else if httpPeer, validHTTPPeer := peer.(network.HTTPPeer); validHTTPPeer { fetcherClient := &HTTPFetcher{ @@ -74,14 +77,14 @@ func (uf *universalBlockFetcher) fetchBlock(ctx context.Context, round basics.Ro log: uf.log, config: &uf.config} fetchedBuf, err = fetcherClient.getBlockBytes(ctx, round) + if err != nil { + return nil, nil, time.Duration(0), err + } address = fetcherClient.address() } else { return nil, nil, time.Duration(0), fmt.Errorf("fetchBlock: UniversalFetcher only supports HTTPPeer and UnicastPeer") } downloadDuration = time.Now().Sub(blockDownloadStartTime) - if err != nil { - return nil, nil, time.Duration(0), err - } block, cert, err := processBlockBytes(fetchedBuf, round, address) if err != nil { return nil, nil, time.Duration(0), err |