@@ -11,97 +11,82 @@
|
||||
var MAX_SUM_TER = 1e9;
|
||||
var MAX_SUM_CENT = 1e9;
|
||||
|
||||
function ADD(Coin,Value2)
|
||||
{
|
||||
function ADD(Coin, Value2) {
|
||||
Coin.SumCOIN += Value2.SumCOIN;
|
||||
Coin.SumCENT += Value2.SumCENT;
|
||||
if(Coin.SumCENT >= MAX_SUM_CENT)
|
||||
{
|
||||
if (Coin.SumCENT >= MAX_SUM_CENT) {
|
||||
Coin.SumCENT -= MAX_SUM_CENT;
|
||||
Coin.SumCOIN++;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
function SUB(Coin,Value2)
|
||||
{
|
||||
function SUB(Coin, Value2) {
|
||||
Coin.SumCOIN -= Value2.SumCOIN;
|
||||
if(Coin.SumCENT >= Value2.SumCENT)
|
||||
{
|
||||
if (Coin.SumCENT >= Value2.SumCENT) {
|
||||
Coin.SumCENT -= Value2.SumCENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
Coin.SumCENT = MAX_SUM_CENT + Coin.SumCENT - Value2.SumCENT;
|
||||
Coin.SumCOIN--;
|
||||
}
|
||||
if(Coin.SumCOIN < 0)
|
||||
{
|
||||
if (Coin.SumCOIN < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
function DIV(Coin,Value)
|
||||
{
|
||||
function DIV(Coin, Value) {
|
||||
Coin.SumCOIN = Coin.SumCOIN / Value;
|
||||
Coin.SumCENT = Math.floor(Coin.SumCENT / Value);
|
||||
var SumCOIN = Math.floor(Coin.SumCOIN);
|
||||
var SumCENT = Math.floor((Coin.SumCOIN - SumCOIN) * MAX_SUM_CENT);
|
||||
Coin.SumCOIN = SumCOIN;
|
||||
Coin.SumCENT = Coin.SumCENT + SumCENT;
|
||||
if(Coin.SumCENT >= MAX_SUM_CENT)
|
||||
{
|
||||
if (Coin.SumCENT >= MAX_SUM_CENT) {
|
||||
Coin.SumCENT -= MAX_SUM_CENT;
|
||||
Coin.SumCOIN++;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
function FLOAT_FROM_COIN(Coin)
|
||||
{
|
||||
function FLOAT_FROM_COIN(Coin) {
|
||||
var Sum = Coin.SumCOIN + Coin.SumCENT / MAX_SUM_CENT;
|
||||
return Sum;
|
||||
};
|
||||
|
||||
function STRING_FROM_COIN(Coin)
|
||||
{
|
||||
function STRING_FROM_COIN(Coin) {
|
||||
var Sum = FLOAT_FROM_COIN(Coin);
|
||||
return Sum.toLocaleString(undefined, {useGrouping:true, style:'decimal', maximumFractionDigits:9});
|
||||
return Sum.toLocaleString(undefined, { useGrouping: true, style: 'decimal', maximumFractionDigits: 9 });
|
||||
};
|
||||
|
||||
function COIN_FROM_FLOAT(Sum)
|
||||
{
|
||||
function COIN_FROM_FLOAT(Sum) {
|
||||
var SumCOIN = Math.floor(Sum);
|
||||
var SumCENT = Math.floor((Sum - SumCOIN) * MAX_SUM_CENT);
|
||||
var Coin = {SumCOIN:SumCOIN, SumCENT:SumCENT};
|
||||
var Coin = { SumCOIN: SumCOIN, SumCENT: SumCENT };
|
||||
return Coin;
|
||||
};
|
||||
|
||||
function COIN_FROM_FLOAT2(Sum)
|
||||
{
|
||||
function COIN_FROM_FLOAT2(Sum) {
|
||||
var SumCOIN = Math.floor(Sum);
|
||||
var SumCENT = Math.floor(Sum * MAX_SUM_CENT - SumCOIN * MAX_SUM_CENT);
|
||||
var Coin = {SumCOIN:SumCOIN, SumCENT:SumCENT};
|
||||
var Coin = { SumCOIN: SumCOIN, SumCENT: SumCENT };
|
||||
return Coin;
|
||||
};
|
||||
if(typeof window === "object")
|
||||
if (typeof window === "object")
|
||||
window.COIN_FROM_FLOAT = COIN_FROM_FLOAT2;
|
||||
|
||||
function ISZERO(Coin)
|
||||
{
|
||||
if(Coin.SumCOIN === 0 && Coin.SumCENT === 0)
|
||||
function ISZERO(Coin) {
|
||||
if (Coin.SumCOIN === 0 && Coin.SumCENT === 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
function COIN_FROM_STRING(Str)
|
||||
{
|
||||
function COIN_FROM_STRING(Str) {
|
||||
throw "TODO: COIN_FROM_STRING";
|
||||
};
|
||||
if(typeof global === "object")
|
||||
{
|
||||
if (typeof global === "object") {
|
||||
global.ADD = ADD;
|
||||
global.SUB = SUB;
|
||||
global.DIV = DIV;
|
||||
|
||||
@@ -9,40 +9,34 @@
|
||||
*/
|
||||
|
||||
|
||||
function SavePrivateKey()
|
||||
{
|
||||
function SavePrivateKey() {
|
||||
var Select = document.getElementById("idTypeKey");
|
||||
if(Select.value === "brain")
|
||||
{
|
||||
if (Select.value === "brain") {
|
||||
ConvertToPrivateKey();
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
var Str = document.getElementById("idKeyNew").value;
|
||||
Str = Str.trim();
|
||||
if(Select.value === "private" && (Str.length !== 64 || !IsHexStr(Str)))
|
||||
{
|
||||
if (Select.value === "private" && (Str.length !== 64 || !IsHexStr(Str))) {
|
||||
SetError("Error: Length must 64 HEX chars. (Length=" + Str.length + ")");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if(Select.value !== "private" && (Str.length !== 66 || Str.substr(0, 1) !== "0" || !IsHexStr(Str)))
|
||||
{
|
||||
if (Select.value !== "private" && (Str.length !== 66 || Str.substr(0, 1) !== "0" || !IsHexStr(Str))) {
|
||||
SetError("Error: Length must 66 HEX chars. (Length=" + Str.length + ")");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
if(Select.value === "private" && PrivKeyStr !== Str)
|
||||
if (Select.value === "private" && PrivKeyStr !== Str)
|
||||
SetStatus("Changed privat key");
|
||||
else
|
||||
if(Select.value === "public" && PubKeyStr !== Str)
|
||||
if (Select.value === "public" && PubKeyStr !== Str)
|
||||
SetStatus("Changed public key");
|
||||
GetData("SetWalletKey", Str, function (Data)
|
||||
{
|
||||
if(Data && Data.result === 1)
|
||||
{
|
||||
if(Select.value === "private")
|
||||
GetData("SetWalletKey", Str, function(Data) {
|
||||
if (Data && Data.result === 1) {
|
||||
if (Select.value === "private")
|
||||
SelectStyle("styleContrast1");
|
||||
else
|
||||
if(Select.value === "public")
|
||||
if (Select.value === "public")
|
||||
SelectStyle("styleContrast2");
|
||||
SetVisibleEditKeys(0);
|
||||
UpdatesData();
|
||||
@@ -50,46 +44,36 @@ function SavePrivateKey()
|
||||
});
|
||||
};
|
||||
|
||||
function CreateCheckPoint()
|
||||
{
|
||||
if(!ServerBlockNumDB || ServerBlockNumDB < 16)
|
||||
{
|
||||
function CreateCheckPoint() {
|
||||
if (!ServerBlockNumDB || ServerBlockNumDB < 16) {
|
||||
SetError("Not set ServerBlockNumDB");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
var BlockNum = ServerBlockNumDB - 10;
|
||||
SetCheckPoint(BlockNum);
|
||||
};
|
||||
|
||||
function UseAutoCheckPoint()
|
||||
{
|
||||
function UseAutoCheckPoint() {
|
||||
var Set = $("idUseAutoCheckPoint").checked;
|
||||
var Period = ParseNum($("idPeriodAutoCheckPoint").value);
|
||||
GetData("SetAutoCheckPoint", {Set:Set, Period:Period}, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
GetData("SetAutoCheckPoint", { Set: Set, Period: Period }, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus(Data.text, !Data.result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function UseAutoCorrTime()
|
||||
{
|
||||
GetData("SetAutoCorrTime", document.getElementById("idUseAutoCorrTime").checked, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
function UseAutoCorrTime() {
|
||||
GetData("SetAutoCorrTime", document.getElementById("idUseAutoCorrTime").checked, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus(Data.text, !Data.result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function SetCodeVersionJSON()
|
||||
{
|
||||
function SetCodeVersionJSON() {
|
||||
var Data = JSON.parse(JSON.stringify(CONFIG_DATA.CODE_VERSION));
|
||||
if(!Data.BlockNum)
|
||||
{
|
||||
if (!Data.BlockNum) {
|
||||
Data.LevelUpdate = 160;
|
||||
}
|
||||
Data.BlockNum = CONFIG_DATA.CurBlockNum;
|
||||
@@ -103,13 +87,11 @@ function SetCodeVersionJSON()
|
||||
document.getElementById("idDevService").value = Str;
|
||||
};
|
||||
|
||||
function SetCorrTimeJSON()
|
||||
{
|
||||
function SetCorrTimeJSON() {
|
||||
var AutoDelta = parseInt(document.getElementById("idDevValue").value);
|
||||
var Data = {Num:CONFIG_DATA.CurBlockNum, bUse:1, bAddTime:1};
|
||||
if(AutoDelta < 0)
|
||||
{
|
||||
AutoDelta = - AutoDelta;
|
||||
var Data = { Num: CONFIG_DATA.CurBlockNum, bUse: 1, bAddTime: 1 };
|
||||
if (AutoDelta < 0) {
|
||||
AutoDelta = - AutoDelta;
|
||||
Data.bAddTime = 0;
|
||||
}
|
||||
Data.DeltaTime = 40;
|
||||
@@ -119,180 +101,140 @@ function SetCorrTimeJSON()
|
||||
document.getElementById("idDevService").value = Str;
|
||||
};
|
||||
|
||||
function SetNetConstJSON()
|
||||
{
|
||||
function SetNetConstJSON() {
|
||||
var Str = JSON.stringify(Data, "", 2);
|
||||
document.getElementById("idDevService").value = Str;
|
||||
var Data = {MaxTrasactionLimit:CONFIG_DATA.MAX_TRANSACTION_LIMIT};
|
||||
var Data = { MaxTrasactionLimit: CONFIG_DATA.MAX_TRANSACTION_LIMIT };
|
||||
var Str = JSON.stringify(Data, "", 2);
|
||||
document.getElementById("idDevService").value = Str;
|
||||
};
|
||||
|
||||
function SetNewCodeVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
function SetNewCodeVersion() {
|
||||
try {
|
||||
var Data = JSON.parse(document.getElementById("idDevService").value);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
catch (e) {
|
||||
SetError("Error format setting data");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
Data.addrArr = GetArrFromHex(Data.addrArr);
|
||||
GetData("SetNewCodeVersion", Data, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
GetData("SetNewCodeVersion", Data, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus(Data.text, !Data.result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function StartTimeCorrect()
|
||||
{
|
||||
try
|
||||
{
|
||||
function StartTimeCorrect() {
|
||||
try {
|
||||
var Data = JSON.parse(document.getElementById("idDevService").value);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
catch (e) {
|
||||
SetError("Error format setting data");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
GetData("SetCheckDeltaTime", Data, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
GetData("SetCheckDeltaTime", Data, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus(Data.text, !Data.result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function StartNetConst()
|
||||
{
|
||||
try
|
||||
{
|
||||
function StartNetConst() {
|
||||
try {
|
||||
var Data = JSON.parse(document.getElementById("idDevService").value);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
catch (e) {
|
||||
SetError("Error format setting data");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
GetData("SetCheckNetConstant", Data, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
GetData("SetCheckNetConstant", Data, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus(Data.text, !Data.result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function RestartNode()
|
||||
{
|
||||
function RestartNode() {
|
||||
GetData("RestartNode", {});
|
||||
DoRestartWallet();
|
||||
};
|
||||
|
||||
function UseAutoUpdate()
|
||||
{
|
||||
var Data = {USE_AUTO_UPDATE:document.getElementById("idAutoUpdate").checked, DoMining:1};
|
||||
GetData("SaveConstant", Data, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
function UseAutoUpdate() {
|
||||
var Data = { USE_AUTO_UPDATE: document.getElementById("idAutoUpdate").checked, DoMining: 1 };
|
||||
GetData("SaveConstant", Data, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
SetStatus("Save AutoUpdate: " + document.getElementById("idAutoUpdate").checked);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function UseMining()
|
||||
{
|
||||
if(!MiningAccount)
|
||||
{
|
||||
function UseMining() {
|
||||
if (!MiningAccount) {
|
||||
SetError("Not set mining account");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
var Data = {USE_MINING:document.getElementById("idUseMining").checked, DoMining:1};
|
||||
GetData("SaveConstant", Data, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
var Data = { USE_MINING: document.getElementById("idUseMining").checked, DoMining: 1 };
|
||||
GetData("SaveConstant", Data, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
SetStatus("Save Mining: " + document.getElementById("idUseMining").checked);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function SetPercentMining()
|
||||
{
|
||||
var Data = {POW_MAX_PERCENT:document.getElementById("idPercentMining").value};
|
||||
GetData("SaveConstant", Data, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
function SetPercentMining() {
|
||||
var Data = { POW_MAX_PERCENT: document.getElementById("idPercentMining").value };
|
||||
GetData("SaveConstant", Data, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
SetStatus("Save Mining percent: " + document.getElementById("idPercentMining").value + " %");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function MiningSets()
|
||||
{
|
||||
function MiningSets() {
|
||||
var name = "edit_mining_set";
|
||||
if(IsVisibleBlock(name))
|
||||
{
|
||||
if (IsVisibleBlock(name)) {
|
||||
SetVisibleBlock(name, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetVisibleBlock(name, true);
|
||||
document.getElementById("idMiningAccount").value = MiningAccount;
|
||||
document.getElementById("idMiningAccount").focus();
|
||||
}
|
||||
};
|
||||
|
||||
function SaveMiningSet(Value)
|
||||
{
|
||||
function SaveMiningSet(Value) {
|
||||
SetVisibleBlock("edit_mining_set", false);
|
||||
if(Value)
|
||||
{
|
||||
if (Value) {
|
||||
MiningAccount = Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
MiningAccount = ParseNum(document.getElementById("idMiningAccount").value);
|
||||
}
|
||||
GetData("SetMining", MiningAccount, function (Data)
|
||||
{
|
||||
GetData("SetMining", MiningAccount, function(Data) {
|
||||
});
|
||||
};
|
||||
|
||||
function CancalMiningSet()
|
||||
{
|
||||
function CancalMiningSet() {
|
||||
var name = "edit_mining_set";
|
||||
SetVisibleBlock(name, false);
|
||||
};
|
||||
var WasHistoryMaxNum;
|
||||
var WasLastNumSound = 0;
|
||||
|
||||
function CheckNewMoney()
|
||||
{
|
||||
return ;
|
||||
if(!$("idUseSoundHistory").checked)
|
||||
return ;
|
||||
if(WasHistoryMaxNum === HistoryMaxNum || !ServerBlockNumDB)
|
||||
return ;
|
||||
function CheckNewMoney() {
|
||||
return;
|
||||
if (!$("idUseSoundHistory").checked)
|
||||
return;
|
||||
if (WasHistoryMaxNum === HistoryMaxNum || !ServerBlockNumDB)
|
||||
return;
|
||||
WasHistoryMaxNum = HistoryMaxNum;
|
||||
GetData("GetHistoryAct", {StartNum:HistoryMaxNum - 40, CountNum:40}, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
GetData("GetHistoryAct", { StartNum: HistoryMaxNum - 40, CountNum: 40 }, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
var arr = Data.arr;
|
||||
for(var i = 0; i < arr.length; i++)
|
||||
{
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var Item = arr[i];
|
||||
if(Item.Direct === "+" && Item.BlockNum > ServerBlockNumDB - 60 && Item.BlockNum < ServerBlockNumDB - 20 && Item.BlockNum > WasLastNumSound)
|
||||
{
|
||||
if (Item.Direct === "+" && Item.BlockNum > ServerBlockNumDB - 60 && Item.BlockNum < ServerBlockNumDB - 20 && Item.BlockNum > WasLastNumSound) {
|
||||
WasLastNumSound = Item.BlockNum;
|
||||
$("sound_coin").play();
|
||||
}
|
||||
@@ -301,52 +243,41 @@ function CheckNewMoney()
|
||||
});
|
||||
};
|
||||
|
||||
function DoRestartWallet()
|
||||
{
|
||||
function DoRestartWallet() {
|
||||
SetStatus("<H1 align='center' style='color:blue'>Restarting program...</H1>");
|
||||
if(!WasSetRestart)
|
||||
{
|
||||
if (!WasSetRestart) {
|
||||
WasSetRestart = 1;
|
||||
setTimeout(function ()
|
||||
{
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
}, 10 * 1000);
|
||||
}
|
||||
};
|
||||
|
||||
function SetArrLog(arr)
|
||||
{
|
||||
function SetArrLog(arr) {
|
||||
var Str = "";
|
||||
var bFindAccount = 0;
|
||||
for(var i = 0; i < arr.length; i++)
|
||||
{
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var Item = arr[i];
|
||||
var tr_text = GetTransactionText(MapSendTransaction[Item.key], Item.key.substr(0, 16));
|
||||
var info = Item.text;
|
||||
if(tr_text)
|
||||
if (tr_text)
|
||||
info += " (" + tr_text + ")";
|
||||
if(Item.final)
|
||||
{
|
||||
if (Item.final) {
|
||||
var TR = MapSendTransaction[Item.key];
|
||||
if(TR)
|
||||
{
|
||||
if(Item.text.indexOf("Add to blockchain") >= 0)
|
||||
{
|
||||
if(TR.bFindAcc)
|
||||
{
|
||||
if (TR) {
|
||||
if (Item.text.indexOf("Add to blockchain") >= 0) {
|
||||
if (TR.bFindAcc) {
|
||||
bFindAccount = 1;
|
||||
TR.bFindAcc = 0;
|
||||
}
|
||||
if(TR.Run)
|
||||
{
|
||||
if (TR.Run) {
|
||||
TR.Run(TR);
|
||||
TR.Run = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
var Account = MapCheckTransaction[Item.key];
|
||||
if(Account)
|
||||
{
|
||||
if (Account) {
|
||||
delete MapCheckTransaction[Item.key];
|
||||
Account.NextSendTime = 0;
|
||||
}
|
||||
@@ -355,39 +286,31 @@ function SetArrLog(arr)
|
||||
}
|
||||
SetStatusFromServer(Str);
|
||||
CheckSending();
|
||||
if(bFindAccount)
|
||||
{
|
||||
if (bFindAccount) {
|
||||
FindMyAccounts();
|
||||
}
|
||||
};
|
||||
|
||||
function SetAutoMining()
|
||||
{
|
||||
setTimeout(function ()
|
||||
{
|
||||
function SetAutoMining() {
|
||||
setTimeout(function() {
|
||||
var Select = $("idAccount");
|
||||
if(Select.options.length)
|
||||
{
|
||||
if (Select.options.length) {
|
||||
SaveMiningSet(Select.options[Select.options.length - 1].value);
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function ViewNetworkMode()
|
||||
{
|
||||
if(IsVisibleBlock('idNetworkView'))
|
||||
{
|
||||
function ViewNetworkMode() {
|
||||
if (IsVisibleBlock('idNetworkView')) {
|
||||
SetVisibleBlock('idNetworkView', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetVisibleBlock('idNetworkView', true);
|
||||
var Mode = CONFIG_DATA.CONSTANTS.NET_WORK_MODE;
|
||||
if(!Mode)
|
||||
{
|
||||
if (!Mode) {
|
||||
Mode = {};
|
||||
Mode.UseDirectIP = true;
|
||||
if(INTERNET_IP_FROM_STUN)
|
||||
if (INTERNET_IP_FROM_STUN)
|
||||
Mode.ip = INTERNET_IP_FROM_STUN;
|
||||
else
|
||||
Mode.ip = SERVER_IP;
|
||||
@@ -396,146 +319,120 @@ function ViewNetworkMode()
|
||||
document.getElementById("idUseDirectIP").checked = Mode.UseDirectIP;
|
||||
document.getElementById("idIP").value = Mode.ip;
|
||||
document.getElementById("idPort").value = Mode.port;
|
||||
if(!Mode.NodeWhiteList)
|
||||
if (!Mode.NodeWhiteList)
|
||||
Mode.NodeWhiteList = "";
|
||||
document.getElementById("idNodeWhiteList").value = Mode.NodeWhiteList;
|
||||
}
|
||||
};
|
||||
|
||||
function SetNetworkParams(bRestart)
|
||||
{
|
||||
function SetNetworkParams(bRestart) {
|
||||
var Mode = {};
|
||||
Mode.UseDirectIP = document.getElementById("idUseDirectIP").checked;
|
||||
Mode.ip = document.getElementById("idIP").value;
|
||||
Mode.port = ParseNum(document.getElementById("idPort").value);
|
||||
Mode.NodeWhiteList = document.getElementById("idNodeWhiteList").value;
|
||||
Mode.DoRestartNode = bRestart;
|
||||
GetData("SetNetMode", Mode, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
GetData("SetNetMode", Mode, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
SetStatus("Set net work params OK");
|
||||
SetVisibleBlock('idNetworkView', false);
|
||||
}
|
||||
});
|
||||
if(bRestart)
|
||||
if (bRestart)
|
||||
DoRestartWallet();
|
||||
};
|
||||
|
||||
function ViewConstant()
|
||||
{
|
||||
if(IsVisibleBlock('idConstantView'))
|
||||
{
|
||||
function ViewConstant() {
|
||||
if (IsVisibleBlock('idConstantView')) {
|
||||
SetVisibleBlock('idConstantView', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetVisibleBlock('idConstantView', true);
|
||||
document.getElementById("idConstant").value = JSON.stringify(CONFIG_DATA.CONSTANTS, "", 2);
|
||||
}
|
||||
};
|
||||
|
||||
function SaveConstant(bRestart)
|
||||
{
|
||||
try
|
||||
{
|
||||
function SaveConstant(bRestart) {
|
||||
try {
|
||||
var Data = JSON.parse(document.getElementById("idConstant").value);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
catch (e) {
|
||||
SetError("Error JSON format setting constant");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
Data.DoRestartNode = bRestart;
|
||||
GetData("SaveConstant", Data, function (Data)
|
||||
{
|
||||
if(Data && Data.result)
|
||||
{
|
||||
GetData("SaveConstant", Data, function(Data) {
|
||||
if (Data && Data.result) {
|
||||
SetStatus("Save Constant OK");
|
||||
SetVisibleBlock('idConstantView', false);
|
||||
}
|
||||
});
|
||||
if(bRestart)
|
||||
if (bRestart)
|
||||
DoRestartWallet();
|
||||
};
|
||||
|
||||
function ViewRemoteParams()
|
||||
{
|
||||
if(IsVisibleBlock('idRemoteView'))
|
||||
{
|
||||
function ViewRemoteParams() {
|
||||
if (IsVisibleBlock('idRemoteView')) {
|
||||
SetVisibleBlock('idRemoteView', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetVisibleBlock('idRemoteView', true);
|
||||
if(CONFIG_DATA.HTTPPort)
|
||||
if (CONFIG_DATA.HTTPPort)
|
||||
document.getElementById("idHTTPPort").value = CONFIG_DATA.HTTPPort;
|
||||
document.getElementById("idHTTPPassword").value = CONFIG_DATA.HTTPPassword;
|
||||
}
|
||||
};
|
||||
|
||||
function SetRemoteParams(bRestart)
|
||||
{
|
||||
function SetRemoteParams(bRestart) {
|
||||
var PrevHTTPPassword = HTTPPassword;
|
||||
var HTTPPort = ParseNum(document.getElementById("idHTTPPort").value);
|
||||
var HTTPPassword = document.getElementById("idHTTPPassword").value;
|
||||
GetData("SetHTTPParams", {HTTPPort:HTTPPort, HTTPPassword:HTTPPassword, DoRestartNode:bRestart}, function (Data)
|
||||
{
|
||||
if(!PrevHTTPPassword && HTTPPassword)
|
||||
GetData("SetHTTPParams", { HTTPPort: HTTPPort, HTTPPassword: HTTPPassword, DoRestartNode: bRestart }, function(Data) {
|
||||
if (!PrevHTTPPassword && HTTPPassword)
|
||||
window.location.reload();
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetVisibleBlock('idRemoteView', false);
|
||||
SetStatus("Set HTTP params OK");
|
||||
}
|
||||
});
|
||||
if(bRestart)
|
||||
if (bRestart)
|
||||
DoRestartWallet();
|
||||
};
|
||||
|
||||
function RewriteAllTransactions()
|
||||
{
|
||||
function RewriteAllTransactions() {
|
||||
DoBlockChainProcess("RewriteAllTransactions", "Rewrite all transactions", 0);
|
||||
};
|
||||
|
||||
function RewriteTransactions()
|
||||
{
|
||||
function RewriteTransactions() {
|
||||
DoBlockChainProcess("RewriteTransactions", "Rewrite transactions on last %1 blocks", 1);
|
||||
};
|
||||
|
||||
function TruncateBlockChain()
|
||||
{
|
||||
function TruncateBlockChain() {
|
||||
DoBlockChainProcess("TruncateBlockChain", "Truncate last %1 blocks", 1);
|
||||
};
|
||||
|
||||
function ClearDataBase()
|
||||
{
|
||||
function ClearDataBase() {
|
||||
DoBlockChainProcess("ClearDataBase", "Clear DataBase", 0);
|
||||
};
|
||||
|
||||
function CleanChain()
|
||||
{
|
||||
function CleanChain() {
|
||||
DoBlockChainProcess("CleanChain", "Clean chain on last %1 blocks", 1);
|
||||
};
|
||||
|
||||
function DoBlockChainProcess(FuncName,Text,LastBlock)
|
||||
{
|
||||
function DoBlockChainProcess(FuncName, Text, LastBlock) {
|
||||
SaveValues();
|
||||
var Params = {};
|
||||
if(LastBlock)
|
||||
{
|
||||
if (LastBlock) {
|
||||
Params.BlockCount = ParseNum(document.getElementById("idBlockCount").value);
|
||||
Text = Text.replace("%1", Params.BlockCount);
|
||||
}
|
||||
var result = confirm(Text + "?");
|
||||
if(!result)
|
||||
return ;
|
||||
if (!result)
|
||||
return;
|
||||
SetVisibleBlock("idServerBlock", 1);
|
||||
SetStatus("START: " + Text);
|
||||
GetData(FuncName, Params, function (Data)
|
||||
{
|
||||
if(Data)
|
||||
{
|
||||
GetData(FuncName, Params, function(Data) {
|
||||
if (Data) {
|
||||
SetStatus("FINISH: " + Text, !Data.result);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user