refactor(local pair sync)_: move partial config to backend (#19753)

cba3ac57...90b18d4f
This commit is contained in:
frank 2024-04-25 12:13:52 +08:00 committed by GitHub
parent 56ff84f475
commit ce3d32dc0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 11 deletions

View File

@ -47,7 +47,8 @@ class AccountManager(private val reactContext: ReactApplicationContext) : ReactC
private fun updateConfig(jsonConfigString: String, absRootDirPath: String, keystoreDirPath: String): String { private fun updateConfig(jsonConfigString: String, absRootDirPath: String, keystoreDirPath: String): String {
val jsonConfig = JSONObject(jsonConfigString) val jsonConfig = JSONObject(jsonConfigString)
val dataDirPath = jsonConfig.getString("DataDir") // when doing local pair syncing, backend will provide default data dir
val dataDirPath = jsonConfig.optString("DataDir","")
val logEnabled = jsonConfig.getBoolean("LogEnabled") val logEnabled = jsonConfig.getBoolean("LogEnabled")
val gethLogFile = if (logEnabled) logManager.prepareLogsFile(reactContext) else null val gethLogFile = if (logEnabled) logManager.prepareLogsFile(reactContext) else null
val gethLogDirPath = gethLogFile?.parent val gethLogDirPath = gethLogFile?.parent
@ -140,7 +141,6 @@ class AccountManager(private val reactContext: ReactApplicationContext) : ReactC
updatedJsonConfigString updatedJsonConfigString
} catch (e: JSONException) { } catch (e: JSONException) {
Log.e(TAG, "updateConfig failed: ${e.message}") Log.e(TAG, "updateConfig failed: ${e.message}")
System.exit(1)
"" ""
} }
} }

View File

@ -66,6 +66,9 @@ RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
NSData *configData = [config dataUsingEncoding:NSUTF8StringEncoding]; NSData *configData = [config dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *configJSON = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil]; NSDictionary *configJSON = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
NSString *relativeDataDir = [configJSON objectForKey:@"DataDir"]; NSString *relativeDataDir = [configJSON objectForKey:@"DataDir"];
if (relativeDataDir == nil) {
relativeDataDir = @"";
}
NSString *absDataDir = [rootUrl.path stringByAppendingString:relativeDataDir]; NSString *absDataDir = [rootUrl.path stringByAppendingString:relativeDataDir];
NSURL *absDataDirUrl = [NSURL fileURLWithPath:absDataDir]; NSURL *absDataDirUrl = [NSURL fileURLWithPath:absDataDir];
NSString *keystoreDir = [@"/keystore/" stringByAppendingString:keyUID]; NSString *keystoreDir = [@"/keystore/" stringByAppendingString:keyUID];

View File

@ -3,8 +3,7 @@
[clojure.string :as string] [clojure.string :as string]
[legacy.status-im.utils.deprecated-types :as types] [legacy.status-im.utils.deprecated-types :as types]
[react-native.platform :as platform] [react-native.platform :as platform]
[status-im.config :as config] [status-im.config :as config]))
[utils.ethereum.chain :as chain]))
(defn- add-log-level (defn- add-log-level
[config log-level] [config log-level]
@ -117,10 +116,7 @@
{:keys [installation-id log-level {:keys [installation-id log-level
waku-bloom-filter-mode]} waku-bloom-filter-mode]}
profile] profile]
(cond-> {:NetworkId (chain/chain-keyword->chain-id :mainnet) (cond-> {}
:DataDir "/ethereum/mainnet_rpc"
:UpstreamConfig {:Enabled true
:URL config/mainnet-rpc-url}}
:always :always
(get-base-node-config) (get-base-node-config)

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.179.9", "version": "v0.179.10",
"commit-sha1": "ebca8b87d1c0a17262c604ea3c07157eaca7a7db", "commit-sha1": "90b18d4f8801b09f68bb5b794a5b6af92001d26e",
"src-sha256": "1nf0pz4k502vh1va1pc45birnm3p83y56a82cynj80y1y7rjmc2m" "src-sha256": "0dlrnpr7wj9z2ywm90avgdzdr9wg71dy82v5jjc9wmiz537mn7wy"
} }