Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

Commit 198c122

Browse files
New min weight magnitude.
1 parent ad7c4e8 commit 198c122

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

app/js/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ var UI = (function(UI, undefined) {
472472
"<div class='input-group'><label><span data-i18n='host' class='label'>" + i18n.t("host") + "</span> <span class='error' id='host-error'></span></label>" +
473473
"<input type='text' id='server_config_host' placeholder='' value='" + (configuration.lightWalletHost ? String(configuration.lightWalletHost).escapeHTML() + (configuration.lightWalletPort ? ":" + String(configuration.lightWalletPort).escapeHTML() : "") : "") + "' /></div>" +
474474
"<div class='input-group'><label data-i18n='min_weight_magnitude'>" + i18n.t("min_weight_magnitude") + "</label>" +
475-
"<input type='number' min='" + (configuration.testNet ? "9" : "13") + "' name='min_weight_magnitude' id='server_config_min_weight_magnitude' placeholder='' value='" + (configuration.minWeightMagnitude ? String(configuration.minWeightMagnitude).escapeHTML() : (configuration.testNet ? "9": "13")) + "' /></div>";
475+
"<input type='number' min='" + configuration.minWeightMagnitudeMinimum + "' name='min_weight_magnitude' id='server_config_min_weight_magnitude' placeholder='' value='" + String(configuration.minWeightMagnitude ? configuration.minWeightMagnitude : configuration.minWeightMagnitudeMinimum).escapeHTML() + "' /></div>";
476476
} else {
477477
content = "<h1 data-i18n='node_config'></h1>" +
478478
"<div class='input-group'><label data-i18n='node_port'>" + i18n.t("node_port") + "</label>" +
@@ -486,7 +486,7 @@ var UI = (function(UI, undefined) {
486486
"<div class='input-group'><label data-i18n='depth'>" + i18n.t("depth") + "</label>" +
487487
"<input type='number' min='1' name='depth' id='server_config_depth' placeholder='' value='" + (configuration.depth ? String(configuration.depth).escapeHTML() : "3") + "' /></div>" +
488488
"<div class='input-group'><label data-i18n='min_weight_magnitude'>" + i18n.t("min_weight_magnitude") + "</label>" +
489-
"<input type='number' min='" + (configuration.testNet ? "9" : "13") + "' name='min_weight_magnitude' id='server_config_min_weight_magnitude' placeholder='' value='" + (configuration.minWeightMagnitude ? String(configuration.minWeightMagnitude).escapeHTML() : (configuration.testNet ? "9": "13")) + "' /></div>" +
489+
"<input type='number' min='" + configuration.minWeightMagnitudeMinimum + "' name='min_weight_magnitude' id='server_config_min_weight_magnitude' placeholder='' value='" + String(configuration.minWeightMagnitude ? configuration.minWeightMagnitude : configuration.minWeightMagnitudeMinimum).escapeHTML() + "' /></div>" +
490490
"<div class='input-group'><label><span data-i18n='db_location'>" + i18n.t("db_location") + "</span> <button id='db_location_select' class='small' style='display:inline-block;'>change</button></label>" +
491491
"<div class='file-path' id='server_config_db_location_preview'>" + String(configuration.dbLocation).escapeHTML() + "</div>" +
492492
"<input type='hidden' name='db_location' id='server_config_db_location' value='" + String(configuration.dbLocation).escapeHTML() + "' />";

app/js/main.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ var App = (function(App, undefined) {
7575
App.uiIsInitialized = false;
7676
App.doNodeStarted = false;
7777

78+
var minWeightMagnitudeMinimum = (isTestNet ? 9 : 15);
79+
7880
App.initialize = function() {
7981
appDirectory = path.dirname(__dirname);
8082
resourcesDirectory = path.dirname(appDirectory);
@@ -174,20 +176,10 @@ var App = (function(App, undefined) {
174176
if (!settings.hasOwnProperty("depth")) {
175177
settings.depth = 3;
176178
}
177-
if (!settings.hasOwnProperty("lastOverride")) {
178-
settings.lastOverride = null;
179-
}
180-
if (settings.lastOverride != 1) {
181-
settings.minWeightMagnitude = (isTestNet ? 9 : 13);
182-
settings.lastOverride = 1;
183-
}
184179
if (!settings.hasOwnProperty("minWeightMagnitude")) {
185-
settings.minWeightMagnitude = 13;
186-
}
187-
if (!isTestNet && settings.minWeightMagnitude < 13) {
188-
settings.minWeightMagnitude = 13;
189-
} else if (isTestNet && settings.minWeightMagnitude < 9) {
190-
settings.minWeightMagnitude = 9;
180+
settings.minWeightMagnitude = minWeightMagnitudeMinimum;
181+
} else if (settings.minWeightMagnitude < minWeightMagnitudeMinimum) {
182+
settings.minWeightMagnitude = minWeightMagnitudeMinimum;
191183
}
192184
if (!settings.hasOwnProperty("nodes") || typeof settings.nodes != "object") {
193185
settings.nodes = [];
@@ -850,6 +842,12 @@ var App = (function(App, undefined) {
850842

851843
App.findDirectories = function() {
852844
try {
845+
/*
846+
if (process.platform == "win32" && process.env.LOCALAPPDATA) {
847+
electron.app.setPath("appData", process.env.LOCALAPPDATA);
848+
//electron.app.setPath("userData", path.join(process.env.LOCALAPPDATA, electron.app.getName()));
849+
}*/
850+
853851
appDataDirectory = path.join(electron.app.getPath("appData"), "IOTA Wallet" + (isTestNet ? " Testnet" : ""));
854852

855853
databaseDirectory = (settings.dbLocation ? settings.dbLocation : path.join(appDataDirectory, "iri"));
@@ -1939,9 +1937,9 @@ var App = (function(App, undefined) {
19391937
walletType = settings.lightWallet;
19401938
}
19411939
if (walletType == 1) {
1942-
var config = {"lightWallet": 1, "lightWalletHost": settings.lightWalletHost, "lightWalletPort": settings.lightWalletPort, "minWeightMagnitude": settings.minWeightMagnitude, "testNet": isTestNet};
1940+
var config = {"lightWallet": 1, "lightWalletHost": settings.lightWalletHost, "lightWalletPort": settings.lightWalletPort, "minWeightMagnitude": settings.minWeightMagnitude, "testNet": isTestNet, "minWeightMagnitudeMinimum": minWeightMagnitudeMinimum};
19431941
} else {
1944-
var config = {"lightWallet": 0, "port": settings.port, "udpReceiverPort": settings.udpReceiverPort, "tcpReceiverPort": settings.tcpReceiverPort, "sendLimit": settings.sendLimit, "depth": settings.depth, "minWeightMagnitude": settings.minWeightMagnitude, "testNet": isTestNet, "dbLocation": databaseDirectory};
1942+
var config = {"lightWallet": 0, "port": settings.port, "udpReceiverPort": settings.udpReceiverPort, "tcpReceiverPort": settings.tcpReceiverPort, "sendLimit": settings.sendLimit, "depth": settings.depth, "minWeightMagnitude": settings.minWeightMagnitude, "testNet": isTestNet, "dbLocation": databaseDirectory, "minWeightMagnitudeMinimum": minWeightMagnitudeMinimum};
19451943
}
19461944
win.webContents.send("editNodeConfiguration", config);
19471945
}
@@ -2081,11 +2079,8 @@ var App = (function(App, undefined) {
20812079

20822080
if (configuration.hasOwnProperty("minWeightMagnitude")) {
20832081
settings.minWeightMagnitude = parseInt(configuration.minWeightMagnitude, 10);
2084-
2085-
if (!isTestNet && settings.minWeightMagnitude < 13) {
2086-
settings.minWeightMagnitude = 13;
2087-
} else if (isTestNet && settings.minWeightMagnitude < 9) {
2088-
settings.minWeightMagnitude = 9;
2082+
if (settings.minWeightMagnitude < minWeightMagnitudeMinimum) {
2083+
settings.minWeightMagnitude = minWeightMagnitudeMinimum;
20892084
}
20902085
}
20912086

ui/js/ui.init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var connection = {"accountData" : false,
1111
"host" : "http://localhost",
1212
"port" : 14265,
1313
"depth" : 3,
14-
"minWeightMagnitude" : 13,
14+
"minWeightMagnitude" : 15,
1515
"ccurlPath" : null,
1616
"lightWallet" : false,
1717
"language" : "en"};

0 commit comments

Comments
 (0)