diff --git a/storage.nim b/storage.nim index fb52066f..f1f4372a 100644 --- a/storage.nim +++ b/storage.nim @@ -65,14 +65,6 @@ when isMainModule: echo "Invalid value for --log-level. " & err.msg quit QuitFailure - if config.mixEnabled: - if config.mixPoolDir.len == 0: - fatal "mix-enabled requires --mix-pool-dir" - quit QuitFailure - if config.bootstrapNodes.len > 0 and config.dhtMixProxies.len == 0: - fatal "mix-enabled requires at least one --dht-mix-proxy" - quit QuitFailure - if err =? config.setupMetrics().errorOption: fatal "Failed to start metrics server", err = err.msg quit QuitFailure diff --git a/storage/discovery.nim b/storage/discovery.nim index f50f7a51..0a806ed0 100644 --- a/storage/discovery.nim +++ b/storage/discovery.nim @@ -116,7 +116,7 @@ method find*( d: Discovery, cid: Cid ): Future[seq[SignedPeerRecord]] {.async: (raises: [CancelledError]), base.} = let providers = - if not d.mixProto.isNil: + if not d.mixProto.isNil and d.dhtMixProxies.len > 0: (await d.findViaMix(cid)).valueOr: warn "Mix lookup failed", cid, err = error.msg return @[] diff --git a/storage/utils/mixidentity.nim b/storage/utils/mixidentity.nim index c8134137..1b739340 100644 --- a/storage/utils/mixidentity.nim +++ b/storage/utils/mixidentity.nim @@ -103,6 +103,9 @@ proc buildMixNodeInfo*( ) proc loadRelayPubInfoTable*(mixPoolDir: string): ?!Table[PeerId, MixPubInfo] = + if mixPoolDir.len == 0: + return success initTable[PeerId, MixPubInfo]() + let pubInfoDir = mixPoolDir / "pubInfo" if not dirExists(pubInfoDir): return failure("Relay pubInfo directory does not exist: " & pubInfoDir) @@ -124,9 +127,6 @@ proc loadRelayPubInfoTable*(mixPoolDir: string): ?!Table[PeerId, MixPubInfo] = t[info.peerId] = info inc i - if t.len == 0: - return failure("No relay entries found in " & pubInfoDir) - success t {.pop.}