1
0
forked from circlecloud/tera

fix: error global replace

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-12 22:46:26 +08:00
parent 92a1edb789
commit 1225f4b2f5
27 changed files with 504 additions and 723 deletions

View File

@@ -10,6 +10,8 @@
"use strict";
import CBlock from './block-loader'
import { RBTree } from './library'
import { STreeBuffer } from './base';
require('./library');
require('./crypto-library');
const TX_PROCESS_TIME = 100;
@@ -52,7 +54,7 @@ export default class CConsensus extends CBlock {
this.CurrentBlockNum = 0
this.SendBlockID = 0
this.RelayMode = false
this.TreeSendPacket = new global.RBTree(global.CompareItemHash)
this.TreeSendPacket = new RBTree(global.CompareItemHash)
if (!global.ADDRLIST_MODE && !this.VirtualMode) {
this.idBlockChainTimer = setInterval(this.StartBlockChain.bind(this), global.CONSENSUS_PERIOD_TIME - 5)
setInterval(this.DoTransfer.bind(this), global.CONSENSUS_CHECK_TIME)
@@ -86,8 +88,8 @@ export default class CConsensus extends CBlock {
Context.TransferFromAddr = {}
Context.LevelsTransfer = []
Context.ErrRun = ""
Context.PowTxTree = new global.RBTree(global.CompareItemTimePow)
Context.PowTicketTree = new global.RBTree(global.CompareItemTimePow)
Context.PowTxTree = new RBTree(global.CompareItemTimePow)
Context.PowTicketTree = new RBTree(global.CompareItemTimePow)
Context.bSave = false
Context.PrevHash = undefined
Context.TreeHash = undefined
@@ -127,7 +129,7 @@ export default class CConsensus extends CBlock {
return Context;
}
StartConsensus() {
if (!global.global.CAN_START)
if (!global.CAN_START)
return;
var StartBlockNum = global.GetCurrentBlockNumByTime();
if (StartBlockNum < global.BLOCK_PROCESSING_LENGTH2)
@@ -137,8 +139,7 @@ export default class CConsensus extends CBlock {
if (!Block0.Active) {
global.AddInfoBlock(Block0, "Activate")
this.StartBlock(Block0)
}
else {
} else {
global.AddInfoBlock(Block0, "Was Active")
}
}
@@ -368,12 +369,10 @@ export default class CConsensus extends CBlock {
this.AddTrToBlockQuote(Block, Data.Array[i], 1)
}
}
static
TRANSFERTX_F() {
static TRANSFERTX_F() {
return "{BlockNum:uint, Array:[{body:tr}]}";
}
static
GETTRANSFERTX_F() {
static GETTRANSFERTX_F() {
return "{BlockNum:uint, TicketArray:[{HashTicket:arr10}]}";
}
GETTRANSFERTX(Info, CurTime) {
@@ -696,7 +695,7 @@ export default class CConsensus extends CBlock {
}
AddPOWToMaxTree(POW, item) {
if (!POW.MaxTree) {
POW.MaxTree = new global.RBTree(function(a, b) {
POW.MaxTree = new RBTree(function(a: any, b: any) {
return global.CompareArr(a.PowHash, b.PowHash);
})
}
@@ -1396,7 +1395,7 @@ export default class CConsensus extends CBlock {
}
}
};
global.TreeBlockBuf = new global.STreeBuffer(50 * 1000, global.CompareItemHashSimple, "string");
global.TreeBlockBuf = new STreeBuffer(50 * 1000, global.CompareItemHashSimple, "string");
var PrevTimeIdle = 0;
OnTimeIdle();