calculateRelaySet method
relay -> list of pubKey mappings
Implementation
Future<RelaySet> calculateRelaySet(
{required String name,
required String ownerPubKey,
required List<String> pubKeys,
required RelayDirection direction,
required int relayMinCountPerPubKey,
Function(String, int, int)? onProgress}) async {
RelaySet byScore = await _relaysByPopularity(
name: name,
ownerPubKey: ownerPubKey,
pubKeys: pubKeys,
direction: direction,
relayMinCountPerPubKey: relayMinCountPerPubKey,
onProgress: onProgress);
/// try by score
if (byScore.relaysMap.isNotEmpty) {
return byScore;
}
/// if everything fails just return a map of all currently registered connected relays for each pubKeys
return RelaySet(
name: name,
pubKey: ownerPubKey,
relayMinCountPerPubkey: relayMinCountPerPubKey,
direction: direction,
relaysMap: _relayManager.allConnectedRelays(pubKeys),
notCoveredPubkeys: []);
}