fix: compaile error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-07-10 18:07:35 +08:00
parent f0d4952b27
commit 63536569cf
7 changed files with 34 additions and 40 deletions

View File

@ -10,19 +10,19 @@
import * as crypto from 'crypto'
global.HTTPCaller.CreateAccount = function(Params, response) {
if (typeof Params === "object" && Params.Name && Params.PubKey) {
var TYPE_TRANSACTION_CREATE = 100;
//var TYPE_TRANSACTION_CREATE = 100;
var TR = {
Type: global.TYPE_TRANSACTION_CREATE,
Currency: Params.Currency,
PubKey: global.GetArrFromHex(Params.PubKey), Description: Params.Name,
Smart: Params.Smart, Adviser: 0,
};
var Body = global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {});
global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {});
return { result: 1 };
}
return { result: 0 };
};
var MaxCountViewRows = global.HTTP_MAX_COUNT_ROWS;
//var MaxCountViewRows = global.HTTP_MAX_COUNT_ROWS;
global.HTTPCaller.GetBalance = function(Params) {
if (typeof Params === "object") {
var arr = global.DApps.Accounts.GetRowsAccounts(global.ParseNum(Params.AccountID), 1);

View File

@ -10,7 +10,7 @@
"use strict";
import * as fs from 'fs'
const FORMAT_EVAL_SEND = "{MaxBlockNum:uint,Code:str,Sign:arr64}";
// const FORMAT_EVAL_SEND = "{MaxBlockNum:uint,Code:str,Sign:arr64}";
module.exports = class CCode extends require("./base")
{
LastEvalCodeNum

View File

@ -664,11 +664,11 @@ module.exports = class CDB extends require("../code")
Block.Hash2 = Value.Hash2
}
if (Filter) {
var Num = Block.BlockNum;
var Bytes = Block.TrDataLen;
var Pow = Block.Power;
var Miner = Block.Miner;
var Date = global.DateFromBlock(Block.BlockNum);
// var Num = Block.BlockNum;
// var Bytes = Block.TrDataLen;
// var Pow = Block.Power;
// var Miner = Block.Miner;
// var Date = global.DateFromBlock(Block.BlockNum);
try {
if (!eval(Filter))
continue;
@ -828,7 +828,7 @@ module.exports = class CDB extends require("../code")
var ArrPowerMy = this.StatMap.ArrPowerMy;
var StartNumStat = this.StatMap.StartBlockNum;
var FinishNumStat = this.StatMap.StartBlockNum + this.StatMap.Length - 1;
var CountReadDB = 0;
// var CountReadDB = 0;
var arr = new Array(MinLength);
var arrmy = new Array(MinLength);
for (var num = start; num < finish; num++) {
@ -839,7 +839,7 @@ module.exports = class CDB extends require("../code")
arrmy[i] = ArrPowerMy[i2]
}
else {
CountReadDB++
// CountReadDB++
var Power = 0, PowerMy = 0;
if (num <= MaxNumBlockDB) {
var Block = this.ReadBlockHeaderDB(num);
@ -929,7 +929,7 @@ module.exports = class CDB extends require("../code")
BlockChainToBuf(WriteNum, StartNum, EndBlockNum) {
if (StartNum === undefined)
return global.BufLib.GetNewBuffer(10);
var GetLength = EndBlockNum - StartNum + 1;
// var GetLength = EndBlockNum - StartNum + 1;
var arr = [];
var arr0 = this.PrevBlockChainArr;
if (arr0 && arr0.length) {

View File

@ -17,9 +17,9 @@ module.exports = class CDBState extends require("./db")
private DataSize;
private Format;
private WorkStruct;
private FileNameFull;
private LastHash;
private WasUpdate;
// private FileNameFull;
// private LastHash;
// private WasUpdate;
private BufMap;
private BufMapCount;
@ -29,10 +29,10 @@ module.exports = class CDBState extends require("./db")
this.DataSize = DataSize
this.Format = Format
this.WorkStruct = {}
var FI = this.OpenDBFile(this.FileName, !bReadOnly);
this.FileNameFull = FI.fname
this.LastHash = undefined
this.WasUpdate = 1
// var FI = this.OpenDBFile(this.FileName, !bReadOnly);
// this.FileNameFull = FI.fname
// this.LastHash = undefined
// this.WasUpdate = 1
this.BufMap = {}
this.BufMapCount = 0
setInterval(this.CheckBufMap.bind(this), 1000)
@ -48,8 +48,8 @@ module.exports = class CDBState extends require("./db")
}
Write(Data, RetBuf) {
var startTime = process.hrtime();
this.LastHash = undefined
this.WasUpdate = 1
// this.LastHash = undefined
// this.WasUpdate = 1
this.CheckNewNum(Data)
Data.Num = Math.trunc(Data.Num)
this.DeleteMap(Data.Num)
@ -118,8 +118,8 @@ module.exports = class CDBState extends require("./db")
Position = 0
var FI = this.OpenDBFile(this.FileName, 1);
if (Position < FI.size) {
this.LastHash = undefined
this.WasUpdate = 1
// this.LastHash = undefined
// this.WasUpdate = 1
if (LastNum < 0)
global.ToLog("Truncate " + this.FileName + " from 0", 2)
FI.size = Position

View File

@ -13,8 +13,8 @@ import * as fs from 'fs'
module.exports = class {
private DBMap;
private LastHash;
private WasUpdate;
// private LastHash;
// private WasUpdate;
private WasCheckPathDB;
constructor() {
@ -25,8 +25,8 @@ module.exports = class {
global.CheckCreateDir(Path)
}
CloseDBFile(name, bdelete) {
this.LastHash = undefined
this.WasUpdate = 1
// this.LastHash = undefined
// this.WasUpdate = 1
var Item = this.DBMap[name];
if (Item) {
let bDelete = bdelete;
@ -55,8 +55,8 @@ module.exports = class {
}
if (bWrite)
CheckStartOneProcess(name + "-run")
this.LastHash = undefined
this.WasUpdate = 1
// this.LastHash = undefined
// this.WasUpdate = 1
var Item = this.DBMap[name];
if (Item === undefined) {
if (!this.WasCheckPathDB) {

View File

@ -9,11 +9,6 @@
*/
import * as fs from 'fs'
let {
ToLog,
MAX_SIZE_LOG
} = global
function CheckSizeLogFile(file_name, file_name_prev) {
"use strict";
let FILE_NAME_LOG = file_name;
@ -21,7 +16,7 @@ function CheckSizeLogFile(file_name, file_name_prev) {
setInterval(function() {
try {
var stat = fs.statSync(FILE_NAME_LOG);
if (stat.size > MAX_SIZE_LOG) {
if (stat.size > global.MAX_SIZE_LOG) {
if (fs.existsSync(FILE_NAME_LOG_PREV)) {
fs.unlinkSync(FILE_NAME_LOG_PREV);
}

View File

@ -17,8 +17,7 @@ var TempArrayTr = new Uint8Array(MAX_MSG_SIZE);
const MESSAGE_START = 9;
const MESSAGE_END = MAX_MSG_SIZE - 5;
require("./names");
class CApp extends require("./dapp")
{
class CApp extends require("./dapp") {
Channels
NamesMap
constructor() {
@ -105,9 +104,9 @@ class CApp extends require("./dapp")
};
function TestEncryptDecrypt() {
const CMessager = module.exports;
var Server = { KeyPair: global.GetKeyPairTest("Test"), DApp: { Names: { KeyValueMap: {} } }, };
var Test = new CMessager(Server);
// const CMessager = module.exports;
// var Server = { KeyPair: global.GetKeyPairTest("Test"), DApp: { Names: { KeyValueMap: {} } }, };
// var Test = new CMessager(Server);
var KeyPair2 = global.GetKeyPairTest("Test2");
var StrTest1 = global.GetArrFromStr("Test2", 32);
var StrKey = global.GetHexFromAddres(StrTest1);