@@ -11,6 +11,8 @@
|
||||
"use strict";
|
||||
import * as fs from 'fs'
|
||||
import CRest from './rest-loader'
|
||||
import { TYPE_TRANSACTION } from '../constant/account';
|
||||
import { STreeBuffer } from './base';
|
||||
//import * as crypto from 'crypto';
|
||||
require('./block-loader-const');
|
||||
const STAT_BLOCK_LOAD_PERIOD = global.CONSENSUS_PERIOD_TIME / 5;
|
||||
@@ -356,7 +358,7 @@ export default class CBlock extends CRest {
|
||||
Node = arr[this.TaskNodeIndex % arr.length]
|
||||
}
|
||||
if (Node.Active) {
|
||||
if (!Node.INFO || !Node.INFO.WasPing || Node.StopGetBlock || (Node.INFO.CheckPointHashDB && global.global.CHECK_POINT.BlockNum && global.CompareArr(global.global.CHECK_POINT.Hash,
|
||||
if (!Node.INFO || !Node.INFO.WasPing || Node.StopGetBlock || (Node.INFO.CheckPointHashDB && global.CHECK_POINT.BlockNum && global.CompareArr(global.CHECK_POINT.Hash,
|
||||
Node.INFO.CheckPointHashDB) !== 0)) {
|
||||
timewait = true
|
||||
continue;
|
||||
@@ -415,8 +417,7 @@ export default class CBlock extends CRest {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static
|
||||
GETBLOCKHEADER_F() {
|
||||
static GETBLOCKHEADER_F() {
|
||||
return "{\
|
||||
Foward:byte,\
|
||||
BlockNum:uint,\
|
||||
@@ -425,8 +426,7 @@ export default class CBlock extends CRest {
|
||||
IsSum:byte\
|
||||
}";
|
||||
}
|
||||
static
|
||||
GETBLOCKHEADER100_F() {
|
||||
static GETBLOCKHEADER100_F() {
|
||||
return "{\
|
||||
BlockNum:uint,\
|
||||
Hash:hash,\
|
||||
@@ -773,8 +773,7 @@ export default class CBlock extends CRest {
|
||||
else {
|
||||
if (global.IsZeroArr(Block.TreeHash)) {
|
||||
Res = this.WriteBlockDB(Block)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
global.ToLogTrace("global.IsZeroArr(Block.TreeHash)")
|
||||
throw "global.IsZeroArr(Block.TreeHash)";
|
||||
}
|
||||
@@ -987,7 +986,7 @@ export default class CBlock extends CRest {
|
||||
}
|
||||
if (arrContent.length > 0 && Data.BlockNum % global.PERIOD_ACCOUNT_HASH === 0) {
|
||||
var TR = arrContent[0];
|
||||
if (TR[0] === global.TYPE_TRANSACTION_ACC_HASH) {
|
||||
if (TR[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH) {
|
||||
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)
|
||||
@@ -1295,8 +1294,7 @@ global.LoadBlockFromNetwork = function(Params, F) {
|
||||
var ResError;
|
||||
if (!Block.arrContent || Block.arrContent.length === 0) {
|
||||
ResError = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ResError = 0;
|
||||
global.SERVER.WriteBlockDB(Block);
|
||||
}
|
||||
@@ -1310,4 +1308,4 @@ global.LoadBlockFromNetwork = function(Params, F) {
|
||||
F(1);
|
||||
}
|
||||
};
|
||||
global.HistoryBlockBuf = new global.STreeBuffer(global.HISTORY_BLOCK_COUNT * 1000, global.CompareItemHashSimple, "string");
|
||||
global.HistoryBlockBuf = new STreeBuffer(global.HISTORY_BLOCK_COUNT * 1000, global.CompareItemHashSimple, "string");
|
||||
|
||||
Reference in New Issue
Block a user