File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ func SweepingProviderOpt(cfg *config.Config) fx.Option {
344344 }
345345 }
346346 if impl == nil {
347- return & NoopProvider {}, nil , errors . New ( "no valid DHT available for providing" )
347+ return & NoopProvider {}, nil , nil
348348 }
349349
350350 var selfAddrsFunc func () []ma.Multiaddr
@@ -407,6 +407,9 @@ func SweepingProviderOpt(cfg *config.Config) fx.Option {
407407
408408 lc .Append (fx.Hook {
409409 OnStart : func (ctx context.Context ) error {
410+ if in .Provider == nil || in .KeyStore == nil {
411+ return nil
412+ }
410413 // Set the KeyProvider as a garbage collection function for the
411414 // keystore. Periodically purge the KeyStore from all its keys and
412415 // replace them with the keys that needs to be reprovided, coming from
@@ -438,6 +441,10 @@ func SweepingProviderOpt(cfg *config.Config) fx.Option {
438441 return nil
439442 },
440443 OnStop : func (ctx context.Context ) error {
444+ if in .Provider == nil || in .KeyStore == nil {
445+ return nil
446+ }
447+
441448 if cancel != nil {
442449 // Cancel KeyStore garbage collection loop
443450 cancel ()
You can’t perform that action at this time.
0 commit comments