From 0ad13d35a74565b148a5aff47e54e50700527698 Mon Sep 17 00:00:00 2001 From: dirkmc Date: Fri, 4 Aug 2023 14:41:57 +0200 Subject: [PATCH] fix: startup with disabled index provider (#1604) --- node/modules/graphsync.go | 6 ++++-- retrievalmarket/server/gsunpaidretrieval.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/node/modules/graphsync.go b/node/modules/graphsync.go index cd6695742..8ecb75b8e 100644 --- a/node/modules/graphsync.go +++ b/node/modules/graphsync.go @@ -69,8 +69,10 @@ func (p *LinkSystemProv) LinkSys() *ipld.LinkSystem { } func SetLinkSystem(proxy *LinkSystemProv, prov provider.Interface) { - e := prov.(*engine.Engine) - proxy.LinkSystem = e.LinkSystem() + e, ok := prov.(*engine.Engine) + if ok { + proxy.LinkSystem = e.LinkSystem() + } } // RetrievalGraphsync creates a graphsync instance used to serve retrievals. diff --git a/retrievalmarket/server/gsunpaidretrieval.go b/retrievalmarket/server/gsunpaidretrieval.go index 2f97a6289..6740a3d2d 100644 --- a/retrievalmarket/server/gsunpaidretrieval.go +++ b/retrievalmarket/server/gsunpaidretrieval.go @@ -120,7 +120,7 @@ func (g *GraphsyncUnpaidRetrieval) Start(ctx context.Context) error { g.ctx = ctx g.validator.ctx = ctx - if g.linkSystem != nil { + if g.linkSystem != nil && g.linkSystem.LinkSys() != nil { // The index provider uses graphsync to fetch advertisements. // We need to tell graphsync to use a different IPLD Link System to provide // the advertisements (instead of using the blockstore).