style: comment unused code and format

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-10 17:53:52 +08:00
parent 812813da8d
commit f0d4952b27
32 changed files with 3958 additions and 5739 deletions

View File

@@ -9,8 +9,8 @@
*/
"use strict";
const fs = require("fs");
import * as crypto from 'crypto';
//const fs = require("fs");
//import * as crypto from 'crypto';
require('./block-loader-const');
const STAT_BLOCK_LOAD_PERIOD = global.CONSENSUS_PERIOD_TIME / 5;
module.exports = class CBlock extends require("./rest-loader")
@@ -264,7 +264,7 @@ module.exports = class CBlock extends require("./rest-loader")
if (global.LOAD_TO_BEGIN && this.BlockNumDBMin) {
this.SendLoadToBegin()
}
var CountStopSend = 0;
//var CountStopSend = 0;
var min_num = this.CurrentBlockNum - global.MAX_COUNT_CHAIN_LOAD;
var min_num_load = this.CurrentBlockNum;
for (var i = 0; i < this.LoadedChainList.length; i++) {
@@ -309,8 +309,9 @@ module.exports = class CBlock extends require("./rest-loader")
chain.StopSend = true
}
}
if (chain && chain.StopSend)
CountStopSend++
if (chain && chain.StopSend) {
//CountStopSend++
}
chain = this.LoadedChainList[i]
if (chain && !chain.GetFindDB() && !chain.StopSend) {
this.SendChainNext(chain, true)
@@ -532,7 +533,7 @@ module.exports = class CBlock extends require("./rest-loader")
chain.BlockHead = Block
if (!chain.BlockNumMax)
chain.BlockNumMax = Block.BlockNum
var PrevBlock0 = PrevBlock;
//var PrevBlock0 = PrevBlock;
if (BlockFind) {
if (PrevBlock) {
PrevBlock.BlockDown = BlockFind
@@ -671,9 +672,9 @@ module.exports = class CBlock extends require("./rest-loader")
for (var num = 0; num < this.LoadedChainList.length; num++) {
var chain = this.LoadedChainList[num];
if (chain && chain.arr && chain.arr.length && chain.StopSend) {
var Count = 0;
//var Count = 0;
for (var i = chain.CurNumArrLoad; i < chain.arr.length; i++) {
Count++
//Count++
var Block = chain.arr[i];
if (!global.IsZeroArr(Block.TreeHash) && !Block.TreeEq && !Block.LoadDBFinaly) {
if (!Block.MapSend) {
@@ -696,13 +697,13 @@ module.exports = class CBlock extends require("./rest-loader")
if (CountSend >= global.MAX_BLOCK_SEND)
return;
}
}
else
} else {
if (i === chain.CurNumArrLoad) {
chain.CurNumArrLoad++
Block.LoadDBFinaly = true
Count = 0
//Count = 0
}
}
}
this.CheckAndWriteLoadedChain(chain)
}
@@ -1029,16 +1030,14 @@ module.exports = class CBlock extends require("./rest-loader")
this.SendF(Node, { "Method": "CANBLOCK", "Data": { BlockNum: Block.BlockNum } })
}
}
static
CANBLOCK_F() {
static CANBLOCK_F() {
return "{BlockNum:uint}";
}
CANBLOCK(Info, CurTime) {
var Data = this.DataFromF(Info);
// var Data = this.DataFromF(Info);
this.SendF(Info.Node, { "Method": "RETCANBLOCK", "Data": { Result: 1 } })
}
static
RETCANBLOCK_F() {
static RETCANBLOCK_F() {
return "{Result:byte}";
}
RETCANBLOCK(Info, CurTime) {
@@ -1149,10 +1148,10 @@ module.exports = class CBlock extends require("./rest-loader")
this.FREE_MEM_BLOCKS(NumMax - global.BLOCK_COUNT_IN_MEMORY)
var maxArrMap = Math.floor(NumMax / global.BLOCK_COUNT_IN_MEMORY) - 1;
if (maxArrMap >= 0) {
var nWasCount = 0;
// var nWasCount = 0;
for (var key in this.MapMapLoaded)
if (key as any < maxArrMap) {
nWasCount++
// nWasCount++
delete this.MapMapLoaded[key]
}
}