From 4bc523e6b4ba8487ef229aea1e1892f07edc3b04 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 13 Nov 2019 09:03:56 -0800 Subject: [PATCH] more wip, squashme --- chain/blocksync/blocksync_client.go | 8 ++++++++ chain/sync_manager.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/chain/blocksync/blocksync_client.go b/chain/blocksync/blocksync_client.go index 52e17f7a3..819a24001 100644 --- a/chain/blocksync/blocksync_client.go +++ b/chain/blocksync/blocksync_client.go @@ -77,6 +77,14 @@ func (bs *BlockSync) GetBlocks(ctx context.Context, tipset []cid.Cid, count int) var oerr error for _, p := range peers { + // TODO: doing this synchronously isnt great, but fetching in parallel + // may not be a good idea either. think about this more + select { + case <-ctx.Done(): + return nil, xerrors.Errorf("blocksync getblocks failed: %w", ctx.Err()) + default: + } + res, err := bs.sendRequestToPeer(ctx, p, req) if err != nil { oerr = err diff --git a/chain/sync_manager.go b/chain/sync_manager.go index a1bb6f5cd..c83a63bcc 100644 --- a/chain/sync_manager.go +++ b/chain/sync_manager.go @@ -54,6 +54,10 @@ func (sm *SyncManager) SetPeerHead(p peer.ID, ts *types.TipSet) { } +func (sm *SyncManager) selectSyncTarget() (*types.TipSet, error) { + panic("NYI") +} + func (sm *SyncManager) syncWorker(id int) { for { select {