Pass `WhisperConfig.LightClient: true` in node config. Closes #3442

- Add code to completely dump the JSON config, not just the first 4000 characters.

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Pedro Pombeiro 2018-02-26 17:35:46 +01:00 committed by Julien Eluard
parent a86e59dbbe
commit bb2a008a27
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
2 changed files with 21 additions and 1 deletions

View File

@ -228,6 +228,16 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
}
} catch (Exception e) {
}
try {
JSONObject whisperConfig = (JSONObject) jsonConfig.get("WhisperConfig");
if (whisperConfig == null) {
whisperConfig = new JSONObject();
}
whisperConfig.put("LightClient", true);
jsonConfig.put("WhisperConfig", whisperConfig);
} catch (Exception e) {
}
jsonConfig.put("KeyStoreDir", newKeystoreDir);
@ -237,7 +247,16 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
Log.d(TAG, "Default configuration will be used");
}
Log.d(TAG, "Node config " + config);
String configOutput = config;
final int maxOutputLen = 4000;
while (!configOutput.isEmpty()) {
Log.d(TAG, "Node config:" + configOutput.substring(0, Math.min(maxOutputLen, configOutput.length())));
if (configOutput.length() > maxOutputLen) {
configOutput = configOutput.substring(maxOutputLen);
} else {
break;
}
}
String res = Statusgo.StartNode(config);
if (res.startsWith("{\"error\":\"\"")) {

View File

@ -205,6 +205,7 @@ RCT_EXPORT_METHOD(startNode:(NSString *)configString) {
[resultingConfigJson setValue:logUrl.path forKey:@"LogFile"];
[resultingConfigJson setValue:([logLevel length] == 0 ? [NSString stringWithUTF8String: "ERROR"] : logLevel) forKey:@"LogLevel"];
[resultingConfigJson setValue:[NSNumber numberWithBool:YES] forKeyPath:@"WhisperConfig.LightClient"];
if(upstreamURL != nil) {
[resultingConfigJson setValue:[NSNumber numberWithBool:YES] forKeyPath:@"UpstreamConfig.Enabled"];
[resultingConfigJson setValue:upstreamURL forKeyPath:@"UpstreamConfig.URL"];