forked from circlecloud/tera
sync: sync upstream code
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
32fbe503b9
commit
305d4b88da
@ -1883,7 +1883,11 @@ function GetPrivKey()
|
|||||||
var Key = sessionStorage[WALLET_KEY_NAME];
|
var Key = sessionStorage[WALLET_KEY_NAME];
|
||||||
if(!Key)
|
if(!Key)
|
||||||
Key = Storage.getItem(WALLET_KEY_NAME);
|
Key = Storage.getItem(WALLET_KEY_NAME);
|
||||||
|
if(Key && typeof Key === "string" && Key.length >= 64)
|
||||||
return Key;
|
return Key;
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function GetPubKey()
|
function GetPubKey()
|
||||||
@ -1891,7 +1895,11 @@ function GetPubKey()
|
|||||||
var Key = sessionStorage[WALLET_PUB_KEY_NAME];
|
var Key = sessionStorage[WALLET_PUB_KEY_NAME];
|
||||||
if(!Key)
|
if(!Key)
|
||||||
Key = Storage.getItem(WALLET_PUB_KEY_NAME);
|
Key = Storage.getItem(WALLET_PUB_KEY_NAME);
|
||||||
|
if(Key && typeof Key === "string" && Key.length >= 64)
|
||||||
return Key;
|
return Key;
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function SetPrivKey(StrPrivKey)
|
function SetPrivKey(StrPrivKey)
|
||||||
@ -1942,3 +1950,11 @@ function XORHash(arr1,arr2,length)
|
|||||||
}
|
}
|
||||||
return arr3;
|
return arr3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function Right(Str,count)
|
||||||
|
{
|
||||||
|
if(Str.length > count)
|
||||||
|
return Str.substr(Str.length - count, count);
|
||||||
|
else
|
||||||
|
return Str.substr(0, Str.length);
|
||||||
|
};
|
||||||
|
@ -131,6 +131,8 @@ function LoadValues()
|
|||||||
var StrDelList = localStorage["DelList"];
|
var StrDelList = localStorage["DelList"];
|
||||||
if(StrDelList)
|
if(StrDelList)
|
||||||
DelList = JSON.parse(StrDelList);
|
DelList = JSON.parse(StrDelList);
|
||||||
|
if(typeof DelList !== "object")
|
||||||
|
DelList = {};
|
||||||
if(LoadValuesByArr(SaveIdArr))
|
if(LoadValuesByArr(SaveIdArr))
|
||||||
{
|
{
|
||||||
ChangeLang();
|
ChangeLang();
|
||||||
@ -409,9 +411,21 @@ function SetAccountsCard(Data,AccountsDataStr)
|
|||||||
var Str = StrAccCardTemplate;
|
var Str = StrAccCardTemplate;
|
||||||
Str = Str.replace("AccCardTemplate", "idCard" + Item.Num);
|
Str = Str.replace("AccCardTemplate", "idCard" + Item.Num);
|
||||||
Str = Str.replace(/{Item.Num}/g, Item.Num);
|
Str = Str.replace(/{Item.Num}/g, Item.Num);
|
||||||
Str = Str.replace("{Value.SumCOIN}", Item.Value.SumCOIN);
|
var Str1, Str2, StrCurrencyName;
|
||||||
Str = Str.replace("{Value.SumCENT}", Item.Value.SumCENT);
|
if(Item.Value.SumCOIN || Item.Value.SumCENT)
|
||||||
Str = Str.replace("{Value.CurrencyName}", CurrencyName(Item.Currency));
|
{
|
||||||
|
Str1 = Item.Value.SumCOIN;
|
||||||
|
Str2 = "," + Right("000000000" + Item.Value.SumCENT, 9);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Str1 = "";
|
||||||
|
Str2 = "";
|
||||||
|
}
|
||||||
|
StrCurrencyName = CurrencyName(Item.Currency);
|
||||||
|
Str = Str.replace("{Value.SumCOIN}", Str1);
|
||||||
|
Str = Str.replace("{Value.SumCENT}", Str2);
|
||||||
|
Str = Str.replace("{Value.CurrencyName}", StrCurrencyName);
|
||||||
var CurrencyObj = Item.CurrencyObj;
|
var CurrencyObj = Item.CurrencyObj;
|
||||||
if(!CurrencyObj)
|
if(!CurrencyObj)
|
||||||
CurrencyObj = {IconBlockNum:0, Num:0};
|
CurrencyObj = {IconBlockNum:0, Num:0};
|
||||||
|
@ -214,7 +214,7 @@
|
|||||||
<a onclick="OpenHistoryPage({Item.Num})" class="prod-card__id prod-card__id--mobile-active pointer">{Item.Num}</a>
|
<a onclick="OpenHistoryPage({Item.Num})" class="prod-card__id prod-card__id--mobile-active pointer">{Item.Num}</a>
|
||||||
<a onclick="OpenHistoryPage({Item.Num})" target='_blank' class="prod-card__id prod-card__id--desktop pointer">{Item.Num}</a>
|
<a onclick="OpenHistoryPage({Item.Num})" target='_blank' class="prod-card__id prod-card__id--desktop pointer">{Item.Num}</a>
|
||||||
<div class="prod-card__heading">
|
<div class="prod-card__heading">
|
||||||
<span class="prod-card__coins-count">{Value.SumCOIN}<sup>,{Value.SumCENT}</sup><br>
|
<span class="prod-card__coins-count">{Value.SumCOIN}<sup>{Value.SumCENT}</sup><br>
|
||||||
<span class="light-grey-text small-text mob-hidden">{Value.CurrencyName}</span>
|
<span class="light-grey-text small-text mob-hidden">{Value.CurrencyName}</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="prod-card__currency prod-card__currency--with-dot">
|
<span class="prod-card__currency prod-card__currency--with-dot">
|
||||||
|
@ -1030,7 +1030,6 @@ export default class CBlock extends CRest {
|
|||||||
var TR = arrContent[0];
|
var TR = arrContent[0];
|
||||||
if (TR[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH) {
|
if (TR[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH) {
|
||||||
if (!global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum)) {
|
if (!global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum)) {
|
||||||
global.ToLog(`global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum) ${JSON.stringify(TR)}, ${Data.BlockNum}`)
|
|
||||||
if (!this.BADHashCount)
|
if (!this.BADHashCount)
|
||||||
this.BADHashCount = 0
|
this.BADHashCount = 0
|
||||||
this.BADHashCount++
|
this.BADHashCount++
|
||||||
@ -1043,8 +1042,6 @@ export default class CBlock extends CRest {
|
|||||||
this.FREE_ALL_MEM_CHAINS()
|
this.FREE_ALL_MEM_CHAINS()
|
||||||
this.SetTruncateBlockDB(Block.BlockNum - 5 * global.DELTA_BLOCK_ACCOUNT_HASH)
|
this.SetTruncateBlockDB(Block.BlockNum - 5 * global.DELTA_BLOCK_ACCOUNT_HASH)
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ global.TRUST_PROCESS_COUNT = 80000;
|
|||||||
global.MAX_NODES_RETURN = 100;
|
global.MAX_NODES_RETURN = 100;
|
||||||
global.MAX_WAIT_PERIOD_FOR_STATUS = 10 * 1000;
|
global.MAX_WAIT_PERIOD_FOR_STATUS = 10 * 1000;
|
||||||
global.MAX_GRAY_CONNECTIONS_TO_SERVER = 10;
|
global.MAX_GRAY_CONNECTIONS_TO_SERVER = 10;
|
||||||
global.MAX_PACKET_LENGTH = 450 * 1024;
|
global.MAX_PACKET_LENGTH = 550 * 1024;
|
||||||
global.COUNT_BLOCKS_FOR_LOAD = 600;
|
global.COUNT_BLOCKS_FOR_LOAD = 600;
|
||||||
global.TR_LEN = 100;
|
global.TR_LEN = 100;
|
||||||
global.BLOCK_PROCESSING_LENGTH = 8;
|
global.BLOCK_PROCESSING_LENGTH = 8;
|
||||||
@ -235,10 +235,12 @@ else
|
|||||||
global.NEW_FORMULA_TARGET1 = 0;
|
global.NEW_FORMULA_TARGET1 = 0;
|
||||||
global.NEW_FORMULA_TARGET2 = 1;
|
global.NEW_FORMULA_TARGET2 = 1;
|
||||||
global.COUNT_NODE_PROOF = 8;
|
global.COUNT_NODE_PROOF = 8;
|
||||||
global.REST_START_COUNT = 10000;
|
|
||||||
global.NEW_SIGN_TIME = 4859000;
|
global.NEW_SIGN_TIME = 4859000;
|
||||||
global.MAX_LENGTH_SENDER_MAP = 100;
|
global.MAX_LENGTH_SENDER_MAP = 100;
|
||||||
global.DELTA_START_SENDER_MAP = 12;
|
global.DELTA_START_SENDER_MAP = 12;
|
||||||
|
global.REST_START_COUNT = 0;
|
||||||
|
global.LOAD_TO_BEGIN = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (global.LOCAL_RUN) {
|
if (global.LOCAL_RUN) {
|
||||||
global.BLOCKNUM_TICKET_ALGO = 0;
|
global.BLOCKNUM_TICKET_ALGO = 0;
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
import CDB from './db/block-db'
|
import CDB from './db/block-db'
|
||||||
import { TYPE_TRANSACTION } from '../constant/account';
|
import { TYPE_TRANSACTION } from '../constant/account';
|
||||||
import { DB_FORMAT } from '../constant/db-format';
|
import { DB_FORMAT } from '../constant/db-format';
|
||||||
|
var MIN_POW_CHAINS = 2;
|
||||||
|
if (global.TEST_NETWORK) {
|
||||||
|
MIN_POW_CHAINS = 1;
|
||||||
|
}
|
||||||
export default class CRest extends CDB {
|
export default class CRest extends CDB {
|
||||||
LoadRestContext
|
LoadRestContext
|
||||||
BlockNumDB
|
BlockNumDB
|
||||||
|
@ -12,10 +12,9 @@
|
|||||||
import * as net from 'net'
|
import * as net from 'net'
|
||||||
// import dgram = require("dgram");
|
// import dgram = require("dgram");
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import "./library"
|
import { secp256k1, RBTree } from "./library"
|
||||||
import "./crypto-library"
|
import "./crypto-library"
|
||||||
import CConnect from './connect'
|
import CConnect from './connect'
|
||||||
import { secp256k1, RBTree } from '../core/library'
|
|
||||||
import { STreeBuffer } from './base';
|
import { STreeBuffer } from './base';
|
||||||
const HARD_PACKET_PERIOD = 20;
|
const HARD_PACKET_PERIOD = 20;
|
||||||
global.BUF_TYPE = 1;
|
global.BUF_TYPE = 1;
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
/*
|
|
||||||
* @project: TERA
|
|
||||||
* @version: Development (beta)
|
|
||||||
* @license: MIT (not for evil)
|
|
||||||
* @copyright: Yuriy Ivanov (Vtools) 2017-2019 [progr76@gmail.com]
|
|
||||||
* Web: https://terafoundation.org
|
|
||||||
* Twitter: https://twitter.com/terafoundation
|
|
||||||
* Telegram: https://t.me/terafoundation
|
|
||||||
*/
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
global.PROCESS_NAME = "TX";
|
global.PROCESS_NAME = "TX";
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
require("../core/constant");
|
import "../core/constant"
|
||||||
global.DATA_PATH = global.GetNormalPathString(global.DATA_PATH);
|
global.DATA_PATH = global.GetNormalPathString(global.DATA_PATH);
|
||||||
global.CODE_PATH = global.GetNormalPathString(global.CODE_PATH);
|
global.CODE_PATH = global.GetNormalPathString(global.CODE_PATH);
|
||||||
require("../core/library");
|
import "../core/library"
|
||||||
global.READ_ONLY_DB = 0;
|
global.READ_ONLY_DB = 0;
|
||||||
var LastAlive = Date.now();
|
var LastAlive = Date.now();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user