Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/neuron-wallet/src/services/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ enum NetworksKey {
}

const oldDefaultNames = ['Default', 'default node', presetNetworks.networks[0].name]
// Before 0.106.0 version the default remote's value is http://localhost:8114
// "localhost" was deprecated because of https://github.com/Magickbase/neuron-public-issues/issues/122
const oldDefaultRemotes = ['http://localhost:8114', BUNDLED_CKB_URL]
Comment thread
Keith-CY marked this conversation as resolved.

export default class NetworksService extends Store {
private static instance: NetworksService
Expand Down Expand Up @@ -263,7 +266,7 @@ export default class NetworksService extends Store {
if (
// make sure that user has not change the network name
oldDefaultNames.includes(oldMainnetNetwork.name) &&
oldMainnetNetwork.remote === defaultMainnetNetwork.remote &&
oldDefaultRemotes.includes(oldMainnetNetwork.remote) &&
oldMainnetNetwork.type === defaultMainnetNetwork.type
) {
this.updateAll([
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-wallet/src/services/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class SettingsService extends Store {
ckbDataPath: path.resolve(app.getPath('userData'), 'chains/mainnet'),
})
)
if (!this.getNodeDataPath(LIGHT_CLIENT_MAINNET)) {
if (!this.getNodeDataPath(LIGHT_CLIENT_MAINNET) || !this.getNodeDataPath('ckb')) {
this.migrateDataPath()
}
}
Expand All @@ -93,8 +93,8 @@ export default class SettingsService extends Store {
migrateDataPath() {
const networkChain = NetworksService.getInstance().getCurrent()?.chain
const currentCkbDataPath = this.readSync(settingKeys.ckbDataPath)
this.writeSync(`${settingKeys.nodeDataPath}_${networkChain}`, currentCkbDataPath)
const defaultMainNetworkDir = path.resolve(app.getPath('userData'), 'chains/mainnet')
this.writeSync(`${settingKeys.nodeDataPath}_${networkChain}`, currentCkbDataPath || defaultMainNetworkDir)
if (networkChain !== 'ckb') {
// if user has changed the ckb data path and running with testnet
this.writeSync(`${settingKeys.nodeDataPath}_ckb`, defaultMainNetworkDir)
Expand Down