diff --git a/src/HTML/CSS/mobile-wallet.css b/src/HTML/CSS/mobile-wallet.css index 0c3fcdf..196f9ed 100644 --- a/src/HTML/CSS/mobile-wallet.css +++ b/src/HTML/CSS/mobile-wallet.css @@ -1,4 +1,4 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700&subset=cyrillic'); +/*@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700&subset=cyrillic');*/ :root { --blue-grey: #445368; @@ -243,7 +243,7 @@ textarea { border: none; color: #000; padding: 5px; - width: 55px; + width: 75px; font-family: inherit; font-size: 12px; line-height: 14px; @@ -1818,7 +1818,7 @@ td.hash { } .header__right select { text-decoration: underline; - width: 60px; + width: 75px; } .header__wallet-link { display: flex; @@ -1859,7 +1859,7 @@ td.hash { font-size: 14px; line-height: 16px; right: 165px; - width: 60px; + width: 75px; border-radius: 3px; background: transparent; color: #000; diff --git a/src/HTML/JS/client.js b/src/HTML/JS/client.js index 57b562c..e9bfc4a 100644 --- a/src/HTML/JS/client.js +++ b/src/HTML/JS/client.js @@ -179,7 +179,7 @@ else function IsIPAddres(Str) { var arr = Str.split("."); - if(arr.length !== 3) + if(arr.length !== 4) return 0; for(var i = 0; i < arr.length; i++) if(arr[i] !== "" + ParseNum(arr[i])) diff --git a/src/HTML/JS/mobile-wallet.js b/src/HTML/JS/mobile-wallet.js index 0581ae9..fd1327c 100644 --- a/src/HTML/JS/mobile-wallet.js +++ b/src/HTML/JS/mobile-wallet.js @@ -8,6 +8,7 @@ * Telegram: https://t.me/terafoundation */ +var WEB_WALLET_VERSION = "0.04"; var SaveIdArr = ["idAccount", "idTo", "idSumSend", "idDescription", "idCurTabName", "idViewBlockNum", "idViewAccountNum", "idViewDappNum", "idLang"]; var CONFIG_DATA = {PRICE_DAO:{NewAccount:10}, MaxNumBlockDB:0, MaxAccID:0, MaxDappsID:0}; @@ -455,7 +456,7 @@ function SetAccountsCard(Data,AccountsDataStr) option.text = StrText; var Str = StrAccCardTemplate; Str = Str.replace("AccCardTemplate", "idCard" + Item.Num); - Str = Str.replace(/{Item.Num}/g, Item.Num); + Str = Str.replace(/\$Item.Num/g, Item.Num); var Str1, Str2; if(Item.Value.SumCOIN || Item.Value.SumCENT) { @@ -468,25 +469,25 @@ function SetAccountsCard(Data,AccountsDataStr) Str2 = ""; } var StrCurrencyName = CurrencyName(Item.Currency); - Str = Str.replace("{Value.SumCOIN}", Str1); - Str = Str.replace("{Value.SumCENT}", Str2); - Str = Str.replace("{Value.CurrencyName}", StrCurrencyName); + Str = Str.replace("$Value.SumCOIN", Str1); + Str = Str.replace("$Value.SumCENT", Str2); + Str = Str.replace("$Value.CurrencyName", StrCurrencyName); var CurrencyObj = Item.CurrencyObj; if(!CurrencyObj) CurrencyObj = {IconBlockNum:0, Num:0}; - Str = Str.replace("{Value.CurrencyIconPath}", RetIconPath(CurrencyObj, 1)); + Str = Str.replace("$value.currencyiconpath", "src='" + RetIconPath(CurrencyObj, 1) + "'"); var CurrencyPath = RetIconPath(CurrencyObj); if(CurrencyPath.substr(0, 6) !== "/file/") Str = Str.replace("prod-card__currency--with-dot", ""); - Str = Str.replace("{Item.Name}", escapeHtml(Item.Name)); + Str = Str.replace("$Item.Name", escapeHtml(Item.Name)); var SmartObj = Item.SmartObj; if(!SmartObj) SmartObj = {Name:"", Num:0, HTMLLength:0}; SmartObj.IconPath = RetIconPath(SmartObj, 0); - Str = Str.replace("{SmartObj.IconPath}", SmartObj.IconPath); - Str = Str.replace("{SmartObj.Name}", escapeHtml(SmartObj.Name)); - Str = Str.replace(/{SmartObj.Num}/g, SmartObj.Num); - Str = Str.replace(/{SmartObj.HTMLLength}/g, SmartObj.HTMLLength); + Str = Str.replace("$smartobj.iconpath", "src='" + SmartObj.IconPath + "'"); + Str = Str.replace("$SmartObj.Name", escapeHtml(SmartObj.Name)); + Str = Str.replace(/\$SmartObj.Num/g, SmartObj.Num); + Str = Str.replace(/\$SmartObj.HTMLLength/g, SmartObj.HTMLLength); if(SmartObj.Num) { Str = Str.replace("prod-card__link--connect", "myhidden"); @@ -639,8 +640,8 @@ function SetExplorerData(Data) FirstCallDiagram = 0; var StrVersion = " 0." + Data.VersionNum; $("idBHeight").innerText = Data.MaxNumBlockDB; - $("idBCurrent").innerText = Data.CurBlockNum; $("idBVersion").innerText = StrVersion; + $("idWVersion").innerText = WEB_WALLET_VERSION; SetArrLog(Data.ArrLog); }; @@ -1030,14 +1031,14 @@ function ViewDapps() function FillDappCard(Str,Item) { CardMapList[Item.Num] = Item; - Str = Str.replace(/{Item.Num}/g, Item.Num); - Str = Str.replace("{Item.Name}", escapeHtml(Item.Name)); - Str = Str.replace("{Item.Description}", escapeHtml(Item.Description)); - Str = Str.replace("{Item.Owner}", Item.Owner); + Str = Str.replace(/\$Item.Num/g, Item.Num); + Str = Str.replace("$Item.Name", escapeHtml(Item.Name)); + Str = Str.replace("$Item.Description", escapeHtml(Item.Description)); + Str = Str.replace("$Item.Owner", Item.Owner); if(!Item.TokenGenerate) Str = Str.replace("dapp-modal__ok-token", "myhidden"); - Str = Str.replace(/{Item.HTMLLength}/g, Item.HTMLLength); - Str = Str.replace("{Item.IconPath}", RetIconPath(Item, 0)); + Str = Str.replace(/\$Item.HTMLLength/g, Item.HTMLLength); + Str = Str.replace("$item.iconpath", "src='" + RetIconPath(Item, 0) + "'"); return Str; }; @@ -1054,8 +1055,8 @@ function OpenDappCard(Num) if(!Item) return ; var Str = FillDappCard(StrDappCardTemplate, Item); - Str = Str.replace("{Item.Account}", RetBaseAccount(Item)); - Str = Str.replace("{Item.BlockNum}", RetOpenBlock(Item.BlockNum, 2)); + Str = Str.replace("$Item.Account", RetBaseAccount(Item)); + Str = Str.replace("$Item.BlockNum", RetOpenBlock(Item.BlockNum, 2)); Str = FillDappCategory(Str, Item, 1); Str = FillDappCategory(Str, Item, 2); Str = FillDappCategory(Str, Item, 3); @@ -1077,7 +1078,7 @@ function FillDappCategory(Str,Item,Num) var Value = Item["Category" + Num]; if(Value && MapCategory[Value]) { - Str = Str.replace("{Item.Category" + Num + "}", MapCategory[Value]); + Str = Str.replace("$Item.Category" + Num, MapCategory[Value]); } else { @@ -1199,7 +1200,7 @@ function InitLangItems() continue; if(!Text) continue; - if(Text.substr(0, 1) === "{") + if(Text.substr(0, 1) === "$") continue; if(Text.toUpperCase() == Text.toLowerCase()) continue; @@ -1266,31 +1267,32 @@ LangMap["RUS"] = {"TERA WALLET":"TERA КОШЕЛЕК", "Generate key":"Сген "Save key":"Сохран.", "+ CREATE A NEW ACCOUNT":"+ СОЗДАТЬ НОВЫЙ СЧЕТ", "Create account":"Создать счет", "Send":"Отправить", "CONFIRM":"Подтверждение", "Accounts":"Счета", "Account(s)":"Счет(а,ов)", "Blocks and Tx":"Блоки и Транзакции", "Counters":"Показатели", "Open DApp":"Открыть Дапп", "Back":"Назад", "Delete":"Удалить", "Save to book":"Сохранить в книгу", "Choose":"Выбрать", "RECONNECT":"КОННЕКТ", - "DApps":"ДАппс", "ID":"ИД", "Amount":"Величина", "Cur":"Вал", "Name":"Имя", "PubKey":"Пуб.ключ", "Operation":"Операция", "Smart":"Смарт", + "DApps":"DApps", "ID":"ИД", "Amount":"Величина", "Cur":"Вал", "Name":"Имя", "PubKey":"Пуб.ключ", "Operation":"Операция", "Smart":"Смарт", "Block Num":"Ном блока", "Num":"Ном", "Date":"Дата", "Data Hash":"Хеш данных", "PowHash":"Хеш сложности", "Block Hash":"Хеш блока", "Bytes":"Байт", "Pow":"Сложн", "Miner":"Майнер", "(secret)":"(секрет)", "Show":"Показать", "TERA":"TERA", "Blockchain height:":"Высота блокчейна:", - "Current create:":"Текущий блок:", "Protocol ver:":"Версия протокола:", "ID: {Item.Num}":"ИД: {Item.Num}", "Token generate":"Генерация токенов", - "ACCOUNTS":"СЧЕТА", "SEND":"ПОСЛАТЬ", "DAPPS":"ДАППС", "EXPLORER":"ПРОСМ", "ATTENTION: Before using the wallet, save the private key.":"ВНИМАНИЕ: Перед использованием кошелька сохраните приватный ключ", + "Current create:":"Текущий блок:", "Protocol ver:":"Версия протокола:", "ID: $Item.Num":"ИД: $Item.Num", "Token generate":"Генерация токенов", + "ACCOUNTS":"СЧЕТА", "SEND":"ОТПРАВИТЬ", "DAPPS":"ДАППС", "EXPLORER":"ПРОСМ", "ATTENTION: Before using the wallet, save the private key.":"ВНИМАНИЕ: Перед использованием кошелька сохраните приватный ключ", "Web-site":"Веб-сайт", "Bitcointalk":"Bitcointalk", "Twitter":"Твиттер", "Telegram":"Телеграм", "Discord":"Дискорд", "QQchat":"QQchat", "Buy/sell/mine TERA":"Купить/Продать", "+ CREATE NEW":"+ СОЗДАТЬ", "Confirm Transaction":"Подтверждение транзакции", "CREATE DAPPS":"СОЗДАТЬ", "Set pass":"Установить пароль", "Unlock":"Разблокировать", "Entrance to sub-wallet":"Войти в под-кошелек", "Public name":"Публичное имя", - "Currency":"Валюта", "Pay to:":"Получатель:", "Amount:":"Сумма:", "Description:":"Описание:", "Welcome to TERA Wallet":"Добропожаловать в кошелек TERA", + "Currency":"Валюта", "Pay to:":"Получатель:", "Amount:":"Сумма:", "Description:":"Описание:", "Welcome to TERA Wallet":"Добро пожаловать в кошелек TERA", "Edit your wallet":"Редактирование вашего кошелька", "Key settings":"Задание ключей", "KEY SETTINGS":"КЛЮЧИ", "Create an account":"Создание счета", - "Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (Даппс)", "Secure your wallet":"Безопасность вашего кошелька", + "Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (DApps)", "Secure your wallet":"Безопасность вашего кошелька", "Wallet is secured":"Установлен пароль", "Total":"Всего", "Item.Name":"Item.Name", "You have no accounts yet":"У вас нет ни одного счета", "Wait 10-15 sec":"Ждите 10-15 сек", "Creating your account":"Идет создание вашего счета", "From:":"Отправитель:", "Set a password for protect entry":"Установите пароль для безопасности", "Enter password to unlock wallet":"Введите пароль для разблокировки кошелька", "From ID:":"Отправитель:", "Pay to ID:":"Получатель:", "Account":"Счет", "Owner":"Владелец", "Block num":"Ном блока", "Private key (secret)":"Приватный ключ (секретно)", "Load key":"Загруз.", "Create your first account and start using TERA":"Создайте свой первый счет и начните использовать TERA", "0 Accounts":"0 Счетов", "OWNER: {Item.Owner}":"Владелец: {Item.Owner}", "More info":"Информация", "Public key":"Публичный ключ", "Enter number of dapp":"Введите номер Даппа", - "Enter the dapps number that will be added to your account. Attention make sure that you trust this dapp, otherwise you may lose all funds in this account.":"Введите номер Даппа, который будет добавлен в ваш аккаунт. Внимание убедитесь, что Вы доверяете ему, в противном случае вы можете потерять все средства на этом счете."}; + "Enter the dapps number that will be added to your account. Attention make sure that you trust this dapp, otherwise you may lose all funds in this account.":"Введите номер Даппа, который будет добавлен в ваш аккаунт. Внимание убедитесь, что Вы доверяете ему, в противном случае вы можете потерять все средства на этом счете.", + "Sending Tx":"Отправка транзакции", }; LangMap["简体中文"] = {"TERA WALLET":"TERA 钱包", "Generate key":"生成私钥", "OK":"OK", "Cancel":"取消", "Edit":"编辑", "Save key":"保存私钥", "+ CREATE A NEW ACCOUNT":"+ 新建账号", "Create account":"创建账号", "Send":"发送", "SEND":"转账", "CONFIRM":"确认", "Accounts":"账号", "Account(s)":"账号", "Blocks and Tx":"区块和交易", "Counters":"状态统计", "Open DApp":"打开DApp", "Back":"返回", "Delete":"删除", "Save to book":"保存到地址本", "Choose":"选择", "RECONNECT":"重连", "DApps":"DApps", "ID":"ID", "Amount":"余额", "Cur":"币种", "Name":"名称", "PubKey":"公钥", "Operation":"操作次数", "Smart":"DApp", "Block Num":"区块编号", "Num":"编号", "Date":"日期", "Data Hash":"数据哈希", "PowHash":"Pow哈希", "Block Hash":"区块哈希", "Bytes":"字节", "Pow":"Pow", "Miner":"矿工", "(secret)":"(机密)", "Show":"显示", "TERA":"TERA", "Blockchain height:":"区块高度:", "Current create:":"最近区块:", "Protocol ver:":"协议版本:", - "ID: {Item.Num}":"ID: {Item.Num}", "Token generate":"生成代币", "ACCOUNTS":"账号", "DAPPS":"DAPPS", "EXPLORER":"浏览器", "ATTENTION: Before using the wallet, save the private key.":"注意: 使用钱包前,务必保存好私钥。", + "Token generate":"生成代币", "ACCOUNTS":"账号", "DAPPS":"DAPPS", "EXPLORER":"浏览器", "ATTENTION: Before using the wallet, save the private key.":"注意: 使用钱包前,务必保存好私钥。", "Web-site":"官网", "Bitcointalk":"创世贴", "Twitter":"推特", "Telegram":"电报", "Discord":"Discord", "QQchat":"QQ群", "Buy/sell/mine TERA":"TERA 交易/挖矿", "+ CREATE NEW":"+ 新建", "Confirm Transaction":"确认交易", "CREATE DAPPS":"创建DAPPS", "Set pass":"设置密码", "Unlock":"解锁", "Entrance to sub-wallet":"进入子钱包", "Public name":"名称", "Currency":"币种", "Pay to:":"收款:", "Amount:":"金额:", "Description:":"描述:", "Welcome to TERA Wallet":"欢迎使用TERA钱包", @@ -1307,9 +1309,8 @@ LangMap["한글"] = {"TERA WALLET":"TERA 지갑", "Generate key":"개인 키 생 "Choose":"선택", "RECONNECT":"다시 연결", "DApps":"DApps", "ID":"ID", "Amount":"잔금", "Cur":"화폐", "Name":"이름", "PubKey":"공공키", "Operation":"조작 횟수", "Smart":"DApp", "Block Num":"블록 번호", "Num":"번호", "Date":"날짜", "Data Hash":"데이터 하희", "PowHash":"Pow하희", "Block Hash":"블록 하희", "Bytes":"바이트", "Pow":"Pow", "Miner":"바이트", "(secret)":"(비밀)", "Show":"쇼", "TERA":"TERA", "Blockchain height:":"블록높이:", "Current create:":"최근 블록:", - "Protocol ver:":"프로토콜 버전:", "ID: {Item.Num}":"ID: {Item.Num}", "Token generate":"생성대폐", "ACCOUNTS":"계정", "SEND":"발송", "DAPPS":"DAPPS", - "EXPLORER":"브라우저", "ATTENTION: Before using the wallet, save the private key.":"주의: 지갑을 사용하기 전에 반드시 개인 키를 저장해야 한다.", "Web-site":"사이트", - "Bitcointalk":"비트 화폐포럼", "Twitter":"트위터", "Telegram":"전보", "Discord":"Discord", "QQchat":"QQ ", "Buy/sell/mine TERA":"TERA거래 /채광", + "Protocol ver:":"프로토콜 버전:", "Token generate":"생성대폐", "ACCOUNTS":"계정", "SEND":"발송", "DAPPS":"DAPPS", "EXPLORER":"브라우저", "ATTENTION: Before using the wallet, save the private key.":"주의: 지갑을 사용하기 전에 반드시 개인 키를 저장해야 한다.", + "Web-site":"사이트", "Bitcointalk":"비트 화폐포럼", "Twitter":"트위터", "Telegram":"전보", "Discord":"Discord", "QQchat":"QQ ", "Buy/sell/mine TERA":"TERA거래 /채광", "+ CREATE NEW":"+신건", "Confirm Transaction":"거래 확인", "CREATE DAPPS":" DAPPS만들기", "Set pass":"비밀번호 설정", "Unlock":"잠금 풀기", "Entrance to sub-wallet":"부속 지갑 들어가기", "Public name":"이름", "Currency":"화폐", "Pay to:":"지불:", "Amount:":"수량:", "Description:":"묘사:", "Welcome to TERA Wallet":"TERA 지갑을 환영합니다", "Edit your wallet":"지갑 편집", "Key settings":"개인 키 설정", "KEY SETTINGS":"개인 키 설정", "Create an account":"계정 만들기", "Sending coins":"동전 보내기", diff --git a/src/HTML/JS/wallet-web.js b/src/HTML/JS/wallet-web.js index 066a094..b940d18 100644 --- a/src/HTML/JS/wallet-web.js +++ b/src/HTML/JS/wallet-web.js @@ -8,12 +8,12 @@ * Telegram: https://t.me/terafoundation */ -var MIN_VERSION = 1020; +var MIN_VERSION = 1114; var COUNT_BLOCK_PROOF = 300; -var MIN_SUM_POWER = COUNT_BLOCK_PROOF * 35; +var MIN_SUM_POWER = 0; var MainServer = undefined; -var MaxConnectedCount = 10; -var MaxTimeConnecting = 3 * 1000; +var MaxConnectedCount = 50; +var TIME_LENGTH_CONNECT_ALL = 2 * 1000; var StartTimeConnecting = 0; var ConnectedCount = 0; var NETWORK = "TERA-MAIN"; @@ -26,7 +26,7 @@ var ServerMainMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"}, "port":80, "Name":"SUPPORT2", "System":1}, "t1.teraexplorer.com":{"ip":"t1.teraexplorer.com", "port":80, "Name":"t1.teraexplorer.com", "System":1}, }; var ServerTestMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"}, "dappsgate.com":{"ip":"dappsgate.com", "port":88, - "Name":"SUPPORT2", "System":1}, }; + "Name":"SUPPORT1", "System":1}, }; function StartWebWallet() { @@ -63,16 +63,21 @@ function OnInitWebWallet() function SaveServerMap() { - var arr = []; - for(var key in ServerMap) + var Arr = GetArrFromServerMap(); + Arr.sort(function (a,b) { - var Item = ServerMap[key]; - if(Item.SumPower >= MIN_SUM_POWER) - { - arr.push({ip:Item.ip, port:Item.port}); - } + if(a.SumPower === b.SumPower) + return a.DeltaTime - b.DeltaTime; + else + return b.SumPower - a.SumPower; + }); + var Arr2 = []; + for(var i = 0; i < Math.min(Arr.length, MaxConnectedCount); i++) + { + var Item = Arr[i]; + Arr2.push({ip:Item.ip, port:Item.port, Stat:Item.Stat, t:Item.DeltaTime}); } - Storage.setItem(NETWORK + "NodesArrayList", JSON.stringify(arr)); + Storage.setItem(NETWORK + "NodesArrayList", JSON.stringify(Arr2)); }; function SetStatus(Str) @@ -111,9 +116,11 @@ function ConnectWebWallet() setTimeout(LoopWalletInfo, 1500); }; var Stage = 0; +var PreparingStartLoopHandShake = 0; function LoopHandShake() { + PreparingStartLoopHandShake = 0; Stage++; SetStatus("Connecting: " + Stage + "..."); for(var key in ServerMap) @@ -130,13 +137,12 @@ function LoopHandShake() function DoNodeList(Item) { - console.log(GetProtocolServerPath(Item) + "/GetNodeList"); if(window.location.protocol === "https:" && Item.port !== 443) return ; if(Item.port === 443 && IsIPAddres(Item.ip)) return ; - SetStatus("Try: " + Item.ip + ":" + Item.port); Item.SendHandShake = 1; + Item.StartTime = Date.now(); GetData(GetProtocolServerPath(Item) + "/GetNodeList", {}, function (Data) { if(Data && Data.result && Data.NETWORK === NETWORK && Data.VersionNum >= MIN_VERSION) @@ -144,7 +150,7 @@ function DoNodeList(Item) ConnectedCount++; Item.GetHandShake = 1; Item.BlockChain = Data.BlockChain; - SetStatus("Get: " + Item.ip + ":" + Item.port); + Item.DeltaTime = Date.now() - Item.StartTime; var bWas = 0; for(var i = 0; i < Data.arr.length; i++) { @@ -152,33 +158,59 @@ function DoNodeList(Item) if(!ServerMap[Node.ip] && Node.port) { ServerMap[Node.ip] = Node; - console.log("New: " + Node.ip + ":" + Node.port); bWas = 1; } } - if(bWas && ConnectedCount < MaxConnectedCount && new Date() - StartTimeConnecting < MaxTimeConnecting) + var DeltaAll = Date.now() - StartTimeConnecting; + if(!PreparingStartLoopHandShake && bWas && ConnectedCount < MaxConnectedCount && DeltaAll < TIME_LENGTH_CONNECT_ALL) { + PreparingStartLoopHandShake = 1; setTimeout(LoopHandShake, 100); } } }); }; -function LoopWalletInfo() +function GetArrFromServerMap() { - SetStatus("Get wallets info..."); + var Arr = []; for(var key in ServerMap) { var Item = ServerMap[key]; if(Item.port) { - CountWallet++; - if(window.BrowserIE && CountWallet > 4) - break; - DoWalletInfo(Item); + if(!Item.SumPower) + Item.SumPower = 0; + if(!Item.DeltaTime) + Item.DeltaTime = 10000; + if(!Item.Stat) + Item.Stat = 0; + Arr.push(Item); } } - setTimeout(FindLider, 500); + return Arr; +}; +var idTimeFindLider = 0; +var CountDoWalletInfoAll = 0; +var CountDoWalletInfoGet = 0; + +function LoopWalletInfo() +{ + CountDoWalletInfoAll = 0; + CountDoWalletInfoGet = 0; + var Arr = GetArrFromServerMap(); + Arr.sort(function (a,b) + { + a.DeltaTime - b.DeltaTime; + }); + CountWallet = Math.min(Arr.length, 8); + if(window.BrowserIE && CountWallet > 4) + CountWallet = 4; + for(var i = 0; i < CountWallet; i++) + { + DoWalletInfo(Arr[i]); + } + idTimeFindLider = setTimeout(FindLider, 2500); }; function DoWalletInfo(Item) @@ -187,18 +219,28 @@ function DoWalletInfo(Item) return ; if(Item.port === 443 && IsIPAddres(Item.ip)) return ; + CountDoWalletInfoAll++; Item.StartTime = Date.now(); Item.SendWalletInfo = 1; GetData(GetProtocolServerPath(Item) + "/GetCurrentInfo", {BlockChain:1}, function (Data) { + if(!idTimeFindLider) + return ; if(Data && Data.result && Data.BlockChain && Data.NETWORK === NETWORK) { Item.Name = Data.NODES_NAME; Item.GetWalletInfo = 1; - Item.DeltaTime = new Date() - Item.StartTime; + Item.DeltaTime2 = Date.now() - Item.StartTime; Item.BlockChain = Data.BlockChain; Item.MaxNumBlockDB = Data.MaxNumBlockDB; - console.log("Get: " + Item.ip + ":" + Item.port + " delta=" + Item.DeltaTime); + SetStatus("Get: " + Item.ip + ":" + Item.port + " t:" + Item.DeltaTime2); + CountDoWalletInfoGet++; + if(idTimeFindLider && CountDoWalletInfoAll && CountDoWalletInfoGet >= 2 && CountDoWalletInfoGet / CountDoWalletInfoAll > 0.7) + { + clearTimeout(idTimeFindLider); + idTimeFindLider = 0; + FindLider(); + } } }); }; @@ -219,7 +261,6 @@ function FindLider() Item.SumPower = CalcPowFromBlockChain(arr); if(Item.SumPower < MIN_SUM_POWER) { - console.log("Skip: " + Item.ip + ":" + Item.port + " SumPower(" + Item.SumPower + ") < MIN_SUM_POWER(" + MIN_SUM_POWER + ")"); continue; } if(!MapSumPower[Item.SumPower]) @@ -239,14 +280,15 @@ function FindLider() } Arr.sort(function (a,b) { - return a.DeltaTime - b.DeltaTime; + return a.DeltaTime2 - b.DeltaTime2; }); for(var i = 0; i < Arr.length; i++) { var Item = Arr[i]; if(Item.SumPower === MaxKey) { - SetStatus("Find " + Item.ip + ":" + Item.port + " with pow=" + Item.SumPower + "/" + MaxKey + " ping=" + Item.DeltaTime); + Item.Stat++; + SetStatus("Find " + Item.ip + ":" + Item.port + " pow=" + Item.SumPower + " t:" + Item.DeltaTime2 + " ms"); MainServer = Item; SaveServerMap(); break; diff --git a/src/HTML/wallet.html b/src/HTML/wallet.html index 1ac883c..2abf48f 100644 --- a/src/HTML/wallet.html +++ b/src/HTML/wallet.html @@ -1632,7 +1632,7 @@
ATTENTION: Before using the wallet, save the private key.
-Private key (secret)
- @@ -100,14 +98,12 @@