Skip to content

Commit

Permalink
Merge pull request #42 from torusresearch/feat/migration-changes
Browse files Browse the repository at this point in the history
minor changes related to migration
  • Loading branch information
chaitanyapotti authored Nov 1, 2023
2 parents 4a887d3 + 2311512 commit d591af5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Sources/CommonSources/Models/AllNodeDetailsModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ public struct AllNodeDetailsModel:Equatable, Decodable {
self.torusNodeTSSEndpoints = torusNodeTSSEndpoints
}

public mutating func setNodeDetails(nodeDetails: AllNodeDetailsModel) {
public mutating func setNodeDetails(nodeDetails: AllNodeDetailsModel, updated: Bool) {
self.torusNodeEndpoints = nodeDetails.torusNodeEndpoints
self.torusNodeSSSEndpoints = nodeDetails.torusNodeSSSEndpoints
self.torusNodeRSSEndpoints = nodeDetails.torusNodeRSSEndpoints
self.torusNodeTSSEndpoints = nodeDetails.torusNodeTSSEndpoints
self.torusNodePub = nodeDetails.torusNodePub
self.torusIndexes = nodeDetails.torusIndexes
self.currentEpoch = nodeDetails.currentEpoch
self.updated = true
self.updated = updated
}
}
2 changes: 1 addition & 1 deletion Sources/FetchNodeDetails/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let TORUS_NETWORK: [TorusNetwork: String] = [
public typealias TORUS_NETWORK_TYPE = String


let MULTI_CLUSTER_NETWORKS: [LegacyNetwork] = [ .AQUA, .CELESTE, .CYAN ]
let MULTI_CLUSTER_NETWORKS: [LegacyNetwork] = [.CELESTE]

let NETWORK_MAP: [LegacyNetwork: String] = [
.MAINNET: "mainnet",
Expand Down
4 changes: 2 additions & 2 deletions Sources/FetchNodeDetails/NodeDetailManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ open class NodeDetailManager {
let (data, _) = try await URLSession.shared.data(from: url)
let response = try JSONDecoder().decode(NodeDetailsResponse.self, from: data)
let nodeDetails = response.getNodeDetails()
fndResult.setNodeDetails(nodeDetails: nodeDetails)
fndResult.setNodeDetails(nodeDetails: nodeDetails, updated: true)
return fndResult
} catch let error {
os_log("Failed to fetch node details from server, using local. %s", log: getTorusLogger(log: FNDLogger.core, type: .error), type: .error, error.localizedDescription)
}
let nodeDetails = try fetchLocalConfig(network: self.network)!
fndResult.setNodeDetails(nodeDetails: nodeDetails)
fndResult.setNodeDetails(nodeDetails: nodeDetails, updated: false)
return fndResult
}

Expand Down
30 changes: 0 additions & 30 deletions Sources/FndBase/Configs/LegacyConfig.swift

This file was deleted.

1 change: 0 additions & 1 deletion Sources/FndBase/Utils/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public func fetchLocalConfig(network: TorusNetwork) throws -> AllNodeDetailsMode
if (network.migration_map.migrationCompleted) {
return try SapphireConfig(network: network.migration_map.networkMigratedTo )
}
if (network == LegacyNetwork.MAINNET ) { return NODE_DETAILS_MAINNET }
return nil

case .sapphire(let network) :
Expand Down

0 comments on commit d591af5

Please sign in to comment.