sync: sync upstream code
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
a11f96e775
commit
cdc11ab46b
@ -18,17 +18,19 @@ var StartTimeConnecting = 0;
|
|||||||
var ConnectedCount = 0;
|
var ConnectedCount = 0;
|
||||||
var NETWORK = "TERA-MAIN";
|
var NETWORK = "TERA-MAIN";
|
||||||
var ServerMap = {};
|
var ServerMap = {};
|
||||||
var ServerMainMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"}, "t2.teraexplorer.com":{"ip":"t2.teraexplorer.com",
|
var ServerMainMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"}, "terawallet.org":{"ip":"terawallet.org", "port":443,
|
||||||
"port":443, "Name":"t2.teraexplorer.com", "System":1}, "t3.teraexplorer.com":{"ip":"t3.teraexplorer.com", "port":443, "Name":"t3.teraexplorer.com",
|
"Name":"terawallet", "System":1}, "teraexplorer.org":{"ip":"teraexplorer.org", "port":443, "Name":"teraexplorer", "System":1},
|
||||||
"System":1}, "t4.teraexplorer.com":{"ip":"t4.teraexplorer.com", "port":443, "Name":"t4.teraexplorer.com", "System":1}, "t5.teraexplorer.com":{"ip":"t5.teraexplorer.com",
|
"t2.teraexplorer.com":{"ip":"t2.teraexplorer.com", "port":443, "Name":"t2.teraexplorer.com", "System":1}, "t3.teraexplorer.com":{"ip":"t3.teraexplorer.com",
|
||||||
"port":443, "Name":"t5.teraexplorer.com", "System":1}, "dappsgate.com":{"ip":"dappsgate.com", "port":80, "Name":"SUPPORT2",
|
"port":443, "Name":"t3.teraexplorer.com", "System":1}, "t4.teraexplorer.com":{"ip":"t4.teraexplorer.com", "port":443, "Name":"t4.teraexplorer.com",
|
||||||
"System":1}, "t1.teraexplorer.com":{"ip":"t1.teraexplorer.com", "port":80, "Name":"t1.teraexplorer.com", "System":1}, };
|
"System":1}, "t5.teraexplorer.com":{"ip":"t5.teraexplorer.com", "port":443, "Name":"t5.teraexplorer.com", "System":1}, "dappsgate.com":{"ip":"dappsgate.com",
|
||||||
|
"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,
|
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":"SUPPORT2", "System":1}, };
|
||||||
|
|
||||||
function StartWebWallet()
|
function StartWebWallet()
|
||||||
{
|
{
|
||||||
if(NETWORK === "TERA-TEST2")
|
if(NETWORK === "TERA-TEST3")
|
||||||
{
|
{
|
||||||
MIN_SUM_POWER = 0;
|
MIN_SUM_POWER = 0;
|
||||||
ServerMap = ServerTestMap;
|
ServerMap = ServerTestMap;
|
||||||
|
@ -1225,9 +1225,24 @@
|
|||||||
if(!Month)
|
if(!Month)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var AvgTotal=0;
|
||||||
|
for(var i=0;i<ArrInfo.length;i++)
|
||||||
|
{
|
||||||
|
var Item=ArrInfo[i];
|
||||||
|
AvgTotal+=Item.AvgPow;
|
||||||
|
}
|
||||||
|
AvgTotal=AvgTotal/ArrInfo.length;
|
||||||
|
|
||||||
function ValueToY(Value)
|
function ValueToY(Value)
|
||||||
{
|
{
|
||||||
return obj.height-(Value-Math.floor(Value/2));
|
var Y=Value-3*AvgTotal/4;
|
||||||
|
if(Y<0)
|
||||||
|
if(Value>=2)
|
||||||
|
Y=1;
|
||||||
|
else
|
||||||
|
Y=0;
|
||||||
|
|
||||||
|
return obj.height-Y*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
var x=0;
|
var x=0;
|
||||||
|
@ -638,7 +638,7 @@
|
|||||||
<div id="idStatus" class="fixed-status__status"> </div>
|
<div id="idStatus" class="fixed-status__status"> </div>
|
||||||
<select class="grey-btn" id="idCurNetwork" onchange="ChangeNetwork()">
|
<select class="grey-btn" id="idCurNetwork" onchange="ChangeNetwork()">
|
||||||
<option value="TERA-MAIN">TERA MAIN</option>
|
<option value="TERA-MAIN">TERA MAIN</option>
|
||||||
<option value="TERA-TEST2">TERA TEST2</option>
|
<option value="TERA-TEST3">TERA TEST3</option>
|
||||||
</select>
|
</select>
|
||||||
<button class="grey-btn reconnect" onclick="ConnectWebWallet()" title="Reconnect"><span>RECONNECT</span></button>
|
<button class="grey-btn reconnect" onclick="ConnectWebWallet()" title="Reconnect"><span>RECONNECT</span></button>
|
||||||
<!--рудименты-->
|
<!--рудименты-->
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import CNode from './node'
|
import CNode from './node'
|
||||||
|
import * as crypto from 'crypto'
|
||||||
import { secp256k1 } from './library'
|
import { secp256k1 } from './library'
|
||||||
global.PERIOD_FOR_RECONNECT = 3600 * 1000;
|
global.PERIOD_FOR_RECONNECT = 3600 * 1000;
|
||||||
global.CHECK_DELTA_TIME = { Num: 0, bUse: 0, StartBlockNum: 0, EndBlockNum: 0, bAddTime: 0, DeltaTime: 0, Sign: [] };
|
global.CHECK_DELTA_TIME = { Num: 0, bUse: 0, StartBlockNum: 0, EndBlockNum: 0, bAddTime: 0, DeltaTime: 0, Sign: [] };
|
||||||
@ -127,7 +128,7 @@ export default class CConnect extends CMessages {
|
|||||||
var key = "" + ip + ":" + port;
|
var key = "" + ip + ":" + port;
|
||||||
Node = this.NodesIPMap[key]
|
Node = this.NodesIPMap[key]
|
||||||
if (!Node) {
|
if (!Node) {
|
||||||
Node = this.GetNewNode(addrStr, ip, port)
|
Node = this.GetNewNode(ip, port, addrStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Node.addrStr !== addrStr) {
|
if (Node.addrStr !== addrStr) {
|
||||||
@ -536,8 +537,7 @@ export default class CConnect extends CMessages {
|
|||||||
}
|
}
|
||||||
}, global.MAX_NODES_RETURN * 250 + 300)
|
}, global.MAX_NODES_RETURN * 250 + 300)
|
||||||
}
|
}
|
||||||
static
|
static RETGETNODES_F() {
|
||||||
RETGETNODES_F() {
|
|
||||||
return "{arr:[\
|
return "{arr:[\
|
||||||
{\
|
{\
|
||||||
addrArr:arr32,\
|
addrArr:arr32,\
|
||||||
@ -565,8 +565,7 @@ export default class CConnect extends CMessages {
|
|||||||
Info.Node.IsAddrList = Data.IsAddrList
|
Info.Node.IsAddrList = Data.IsAddrList
|
||||||
global.AddNodeInfo(Info.Node, "RETGETNODES length=" + arr.length)
|
global.AddNodeInfo(Info.Node, "RETGETNODES length=" + arr.length)
|
||||||
}
|
}
|
||||||
static
|
static RETGETNODES2_F() {
|
||||||
RETGETNODES2_F() {
|
|
||||||
return "{arr:[\
|
return "{arr:[\
|
||||||
{\
|
{\
|
||||||
addrStr:str64,\
|
addrStr:str64,\
|
||||||
@ -593,11 +592,36 @@ export default class CConnect extends CMessages {
|
|||||||
Info.Node.IsAddrList = Data.IsAddrList
|
Info.Node.IsAddrList = Data.IsAddrList
|
||||||
global.AddNodeInfo(Info.Node, "RETGETNODES2 length=" + arr.length)
|
global.AddNodeInfo(Info.Node, "RETGETNODES2 length=" + arr.length)
|
||||||
}
|
}
|
||||||
GetNewNode(addrStr, ip, port) {
|
GetNewNode(ip, port, addrStr?) {
|
||||||
|
var bTemp;
|
||||||
|
if (!addrStr) {
|
||||||
|
bTemp = 1
|
||||||
|
addrStr = global.GetHexFromAddres(crypto.randomBytes(32))
|
||||||
|
}
|
||||||
var Node = new CNode(addrStr, ip, port);
|
var Node = new CNode(addrStr, ip, port);
|
||||||
this.AddToArrNodes(Node, false)
|
this.AddToArrNodes(Node, false)
|
||||||
|
if (bTemp)
|
||||||
|
Node.addrStrTemp = addrStr
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
AddNode(Str) {
|
||||||
|
var ip, port;
|
||||||
|
var Index = Str.indexOf(":");
|
||||||
|
if (Index > 0) {
|
||||||
|
ip = Str.substr(0, Index)
|
||||||
|
port = ParseNum(Str.substr(Index + 1))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ip = Str
|
||||||
|
if (global.TEST_NETWORK || global.LOCAL_RUN) {
|
||||||
|
port = 40000
|
||||||
|
} else {
|
||||||
|
port = 30000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.GetNewNode(ip, port)
|
||||||
|
return "AddNode " + ip + ":" + port;
|
||||||
|
}
|
||||||
IsCanConnect(Node) {
|
IsCanConnect(Node) {
|
||||||
if (Node.addrStr === this.addrStr || this.NodeInBan(Node) || Node.Delete || Node.Self || Node.DoubleConnection)
|
if (Node.addrStr === this.addrStr || this.NodeInBan(Node) || Node.Delete || Node.Self || Node.DoubleConnection)
|
||||||
return false;
|
return false;
|
||||||
|
@ -154,6 +154,7 @@ global.TRANSACTION_PROOF_COUNT = 1000 * 1000;
|
|||||||
global.MIN_POWER_POW_ACC_CREATE = 16;
|
global.MIN_POWER_POW_ACC_CREATE = 16;
|
||||||
global.START_MINING = 2 * 1000 * 1000;
|
global.START_MINING = 2 * 1000 * 1000;
|
||||||
global.REF_PERIOD_MINING = 1 * 1000 * 1000;
|
global.REF_PERIOD_MINING = 1 * 1000 * 1000;
|
||||||
|
global.REF_PERIOD_END = 30 * 1000 * 1000;
|
||||||
global.DELTA_BLOCK_ACCOUNT_HASH = 1000;
|
global.DELTA_BLOCK_ACCOUNT_HASH = 1000;
|
||||||
global.PERIOD_ACCOUNT_HASH = 50;
|
global.PERIOD_ACCOUNT_HASH = 50;
|
||||||
global.START_BLOCK_ACCOUNT_HASH = 14500000;
|
global.START_BLOCK_ACCOUNT_HASH = 14500000;
|
||||||
@ -212,26 +213,27 @@ else
|
|||||||
var Num = Date.now() - 50 * 1000;
|
var Num = Date.now() - 50 * 1000;
|
||||||
console.log("CURRENT NUM: " + (Math.trunc(Num / 1000) * 1000));
|
console.log("CURRENT NUM: " + (Math.trunc(Num / 1000) * 1000));
|
||||||
global.SMART_BLOCKNUM_START = 0;
|
global.SMART_BLOCKNUM_START = 0;
|
||||||
global.START_NETWORK_DATE = 1550843168000 + 1000 * 1000;
|
global.START_NETWORK_DATE = 1563043550000 + 500 * 1000;
|
||||||
global.START_MINING = 1000;
|
global.START_MINING = 100;
|
||||||
global.REF_PERIOD_MINING = 1000;
|
global.REF_PERIOD_END = 0;
|
||||||
|
global.REF_PERIOD_MINING = 200;
|
||||||
global.MIN_POWER_POW_ACC_CREATE = 8;
|
global.MIN_POWER_POW_ACC_CREATE = 8;
|
||||||
global.TRANSACTION_PROOF_COUNT = 200 * 1000;
|
global.TRANSACTION_PROOF_COUNT = 200 * 1000;
|
||||||
global.MAX_SIZE_LOG = 20 * 1024 * 1024;
|
global.MAX_SIZE_LOG = 20 * 1024 * 1024;
|
||||||
global.START_BLOCK_ACCOUNT_HASH = 1000;
|
global.START_BLOCK_ACCOUNT_HASH = 100;
|
||||||
global.START_BLOCK_ACCOUNT_HASH3 = 2356000;
|
global.START_BLOCK_ACCOUNT_HASH3 = 200;
|
||||||
global.BLOCKNUM_TICKET_ALGO = 1;
|
global.BLOCKNUM_TICKET_ALGO = 1;
|
||||||
global.WALLET_NAME = "TEST";
|
global.WALLET_NAME = "TEST";
|
||||||
global.NETWORK = "TERA-TEST2";
|
global.NETWORK = "TERA-TEST3";
|
||||||
if (global.START_PORT_NUMBER === undefined)
|
if (global.START_PORT_NUMBER === undefined)
|
||||||
global.START_PORT_NUMBER = 40000;
|
global.START_PORT_NUMBER = 40000;
|
||||||
global.ALL_VIEW_ROWS = 1;
|
global.ALL_VIEW_ROWS = 1;
|
||||||
global.NEW_ACCOUNT_INCREMENT = 1903000;
|
global.NEW_ACCOUNT_INCREMENT = 1;
|
||||||
global.NEW_BLOCK_REWARD1 = 1905000;
|
global.NEW_BLOCK_REWARD1 = 1;
|
||||||
global.NEW_FORMULA_START = 11402000;
|
global.NEW_FORMULA_START = 1;
|
||||||
global.NEW_FORMULA_KTERA = 3;
|
global.NEW_FORMULA_KTERA = 3;
|
||||||
global.NEW_FORMULA_TARGET1 = 11403000;
|
global.NEW_FORMULA_TARGET1 = 0;
|
||||||
global.NEW_FORMULA_TARGET2 = 11405000;
|
global.NEW_FORMULA_TARGET2 = 1;
|
||||||
global.COUNT_NODE_PROOF = 8;
|
global.COUNT_NODE_PROOF = 8;
|
||||||
global.REST_START_COUNT = 10000;
|
global.REST_START_COUNT = 10000;
|
||||||
global.NEW_SIGN_TIME = 4859000;
|
global.NEW_SIGN_TIME = 4859000;
|
||||||
|
@ -21,8 +21,10 @@ function RunOnUpdate() {
|
|||||||
global.ToLog("UPDATER Start");
|
global.ToLog("UPDATER Start");
|
||||||
global.SaveParams(fname, UpdateInfo);
|
global.SaveParams(fname, UpdateInfo);
|
||||||
if (global.TEST_NETWORK || global.LOCAL_RUN) {
|
if (global.TEST_NETWORK || global.LOCAL_RUN) {
|
||||||
}
|
if (CurNum < 1137) {
|
||||||
else {
|
global.SERVER.ClearDataBase();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
global.ToLog("UPDATER Finish");
|
global.ToLog("UPDATER Finish");
|
||||||
}
|
}
|
||||||
|
1
src/global.d.ts
vendored
1
src/global.d.ts
vendored
@ -138,6 +138,7 @@ declare global {
|
|||||||
MIN_POWER_POW_ACC_CREATE: number;
|
MIN_POWER_POW_ACC_CREATE: number;
|
||||||
START_MINING: number;
|
START_MINING: number;
|
||||||
REF_PERIOD_MINING: number;
|
REF_PERIOD_MINING: number;
|
||||||
|
REF_PERIOD_END: number;
|
||||||
DELTA_BLOCK_ACCOUNT_HASH: number;
|
DELTA_BLOCK_ACCOUNT_HASH: number;
|
||||||
PERIOD_ACCOUNT_HASH: number;
|
PERIOD_ACCOUNT_HASH: number;
|
||||||
START_BLOCK_ACCOUNT_HASH: number;
|
START_BLOCK_ACCOUNT_HASH: number;
|
||||||
|
@ -642,9 +642,7 @@ function DoStartFindList() {
|
|||||||
var key = item.ip + ":" + item.port;
|
var key = item.ip + ":" + item.port;
|
||||||
if (keyThisServer === key)
|
if (keyThisServer === key)
|
||||||
continue;
|
continue;
|
||||||
var addrStr = global.GetHexFromAddres(crypto.randomBytes(32));
|
var Node = global.SERVER.GetNewNode(item.ip, item.port);
|
||||||
var Node = global.SERVER.GetNewNode(addrStr, item.ip, item.port);
|
|
||||||
Node.addrStrTemp = addrStr;
|
|
||||||
Node.StartFindList = 1;
|
Node.StartFindList = 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -359,7 +359,6 @@ export default class AccountApp extends DApp {
|
|||||||
var SysData = this.ReadStateTR(0);
|
var SysData = this.ReadStateTR(0);
|
||||||
var SysBalance = SysData.Value.SumCOIN;
|
var SysBalance = SysData.Value.SumCOIN;
|
||||||
const REF_PERIOD_START = global.START_MINING;
|
const REF_PERIOD_START = global.START_MINING;
|
||||||
const REF_PERIOD_END = 30 * 1000 * 1000;
|
|
||||||
var AccountID = global.ReadUintFromArr(Block.AddrHash, 0);
|
var AccountID = global.ReadUintFromArr(Block.AddrHash, 0);
|
||||||
if (AccountID < 8)
|
if (AccountID < 8)
|
||||||
return;
|
return;
|
||||||
@ -385,10 +384,10 @@ export default class AccountApp extends DApp {
|
|||||||
var CoinTotal = { SumCOIN: 0, SumCENT: 0 };
|
var CoinTotal = { SumCOIN: 0, SumCENT: 0 };
|
||||||
var CoinSum = global.COIN_FROM_FLOAT(Sum);
|
var CoinSum = global.COIN_FROM_FLOAT(Sum);
|
||||||
if (!global.ISZERO(CoinSum)) {
|
if (!global.ISZERO(CoinSum)) {
|
||||||
if (Data.Adviser >= 8 && Block.BlockNum < REF_PERIOD_END) {
|
if (Data.Adviser >= 8 && Block.BlockNum < global.REF_PERIOD_END) {
|
||||||
var RefData = this.ReadStateTR(Data.Adviser);
|
var RefData = this.ReadStateTR(Data.Adviser);
|
||||||
if (RefData && RefData.BlockNumCreate < Block.BlockNum - global.REF_PERIOD_MINING) {
|
if (RefData && RefData.BlockNumCreate < Block.BlockNum - global.REF_PERIOD_MINING) {
|
||||||
var K = (REF_PERIOD_END - Block.BlockNum) / (REF_PERIOD_END - REF_PERIOD_START);
|
var K = (global.REF_PERIOD_END - Block.BlockNum) / (global.REF_PERIOD_END - REF_PERIOD_START);
|
||||||
var CoinAdv = global.COIN_FROM_FLOAT(Sum * K);
|
var CoinAdv = global.COIN_FROM_FLOAT(Sum * K);
|
||||||
this.SendMoneyTR(Block, 0, Data.Adviser, CoinAdv, Block.BlockNum, 0xFFFF, "", "Adviser coin base [" + AccountID + "]", 1)
|
this.SendMoneyTR(Block, 0, Data.Adviser, CoinAdv, Block.BlockNum, 0xFFFF, "", "Adviser coin base [" + AccountID + "]", 1)
|
||||||
global.ADD(CoinTotal, CoinAdv)
|
global.ADD(CoinTotal, CoinAdv)
|
||||||
@ -791,6 +790,8 @@ export default class AccountApp extends DApp {
|
|||||||
return DBAct.FastFindBlockNum(BlockNum);
|
return DBAct.FastFindBlockNum(BlockNum);
|
||||||
}
|
}
|
||||||
GetHole() {
|
GetHole() {
|
||||||
|
if (global.TEST_NETWORK)
|
||||||
|
return [];
|
||||||
return [{ s: 8300, f: 186478 }];
|
return [{ s: 8300, f: 186478 }];
|
||||||
}
|
}
|
||||||
IsHole(num) {
|
IsHole(num) {
|
||||||
|
Loading…
Reference in New Issue
Block a user