diff --git a/.gitignore b/.gitignore index 9a6232e..d719368 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ screenshot .eslintcache build -DATA +DATA* diff --git a/src/core/block-exchange.ts b/src/core/block-exchange.ts index 6457a06..8de1902 100644 --- a/src/core/block-exchange.ts +++ b/src/core/block-exchange.ts @@ -100,7 +100,7 @@ export default class CConsensus extends CBlock { Context.TrDataLen = 0 Context.Info = "Create at:" + global.GetStrOnlyTimeUTC() var Transfer; - //var TransferM2; + var TransferM2; var LocalLevel = 0; var Levels = this.LevelNodes; for (let L = 0; L < Levels.length; L++) { @@ -1282,13 +1282,11 @@ export default class CConsensus extends CBlock { return; } } - } - else { + } else { this.OwnBlockCount = 0 } } - } - else { + } else { Block.HasErr = 1 if (!PrevBlock.bSave) global.AddInfoBlock(Block, "Prev block not saved") diff --git a/src/core/crypto-library.ts b/src/core/crypto-library.ts index 7886cfa..54c4a38 100644 --- a/src/core/crypto-library.ts +++ b/src/core/crypto-library.ts @@ -984,3 +984,57 @@ if (global.TEST_NETWORK || global.LOCAL_RUN) { global.DEVELOP_PUB_KEY_ARR = [global.DEVELOP_PUB_KEY0]; global.DEVELOP_PUB_KEY = DEVELOP_PUB_KEY_ARR[0]; } +declare global { + namespace NodeJS { + interface Global { + //#region dapp.ts + MAX_SUPER_VALUE_POW: number; + GetHexFromAddres: Function; + GetArr32FromHex: Function; + GetAddresFromHex: Function; + GetHexAddresFromPublicKey: Function; + GetHexFromArr: Function; + GetArrFromHex: Function; + GetHexFromArrBlock: Function; + GetPublicKeyFromAddres: Function; + CheckDevelopSign: Function; + CheckContextSecret: Function; + GetSignHash: Function; + GetVerifyHash: Function; + GetKeyPair: Function; + GetKeyPairTest: Function; + GetHashWithValues: Function; + CreateNoncePOWExtern: Function; + CreateNoncePOWExternMinPower: Function; + CreateNoncePOWInner: Function; + CreateAddrPOW: Function; + CalcMerkl3FromArray: Function; + CalcMerkl0FromArray: Function; + ClientHex: Function; + CalcHash3FromArray: Function; + CalcHashFromArray: Function; + CalcMerklFromArray: Function; + CalcTreeHashFromArrBody: Function; + UpdateMerklTree: Function; + GetMerkleProof: Function; + CheckMerkleProof: Function; + IsZeroArr: Function; + GetHashWithNonce: Function; + GetPowPower: Function; + GetArrFromValue: Function; + GetPowValue: Function; + Mesh: Function; + Encrypt: Function; + Decrypt: Function; + toUTF8Array: Function; + Utf8ArrayToStr: Function; + GetArrFromStr: Function; + IsDeveloperAccount: Function; + DEVELOP_PUB_KEY_ARR: Buffer[] | string[]; + DEVELOP_PUB_KEY: any; + DEVELOP_PUB_KEY0: Buffer; + ARR_PUB_KEY: any; + //#endregion + } + } +} \ No newline at end of file diff --git a/src/core/html-server.ts b/src/core/html-server.ts index bfe04d7..8c6a3fd 100644 --- a/src/core/html-server.ts +++ b/src/core/html-server.ts @@ -58,8 +58,7 @@ function DoCommand(response, Type, Path, params, remoteAddress) { try { var Str = JSON.stringify(Ret); response.end(Str); - } - catch (e) { + } catch (e) { global.ToLog("ERR PATH:" + Path); global.ToLog(e); response.end(); @@ -202,19 +201,18 @@ function SendBlockFile(response, BlockNum, TrNum) { if (Block && Block.arrContent) { SendToResponceFile(response, Block, TrNum); return; - } - else + } else { if (!Block || !Block.TrDataPos) { global.LoadBlockFromNetwork({ BlockNum: BlockNum }, function(Err, Block) { if (Err) { SendToResponce404(response); - } - else { + } else { SendToResponceFile(response, Block, TrNum); } }); return; } + } } SendToResponce404(response); }; @@ -230,8 +228,7 @@ function SendToResponceFile(response, Block, TrNum) { else response.writeHead(200, { 'Content-Type': TR.ContentType }); response.end(TR.Data); - } - else { + } else { SendToResponce404(response); } }; @@ -250,19 +247,18 @@ HTTPCaller.DappBlockFile = function(Params, response) { if (Block && Block.arrContent) { SendToResponceDappFile(response, Block, Params.TrNum); return null; - } - else + } else { if (!Block || !Block.TrDataPos) { global.LoadBlockFromNetwork(Params, function(Err, Block) { if (Err) { SendToResponceResult0(response); - } - else { + } else { SendToResponceDappFile(response, Block, Params.TrNum); } }); return null; } + } } return { result: 0 }; }; @@ -275,8 +271,7 @@ function SendToResponceDappFile(response, Block, TrNum) { if (Type === global.TYPE_TRANSACTION_FILE) { var TR = global.DApps.File.GetObjectTransaction(Body); Result = { result: 1, Type: Type, ContentType: TR.ContentType, Name: TR.Name, Body: TR.Data.toString('utf8') }; - } - else { + } else { var App = global.DAppByType[Type]; if (App) { Body = JSON.parse(App.GetScriptTransaction(Body)); @@ -306,8 +301,7 @@ HTTPCaller.DappStaticCall = function(Params, response) { var RetValue; try { RetValue = global.RunSmartMethod(glBlock0, Account.Value.Smart, Account, 0, 0, undefined, Params.MethodName, Params.Params, 1); - } - catch (e) { + } catch (e) { return { result: 0, RetValue: "" + e }; } var Str = JSON.stringify({ result: 1, RetValue: RetValue }); diff --git a/src/global.d.ts b/src/global.d.ts index dd2ae2c..74cfe0b 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -279,54 +279,54 @@ declare global { NO_HISTORY_MODE: boolean; //#endregion - //#region crypto-library.ts - MAX_SUPER_VALUE_POW: number; - GetHexFromAddres: Function; - GetArr32FromHex: Function; - GetAddresFromHex: Function; - GetHexAddresFromPublicKey: Function; - GetHexFromArr: Function; - GetArrFromHex: Function; - GetHexFromArrBlock: Function; - GetPublicKeyFromAddres: Function; - CheckDevelopSign: Function; - CheckContextSecret: Function; - GetSignHash: Function; - GetVerifyHash: Function; - GetKeyPair: Function; - GetKeyPairTest: Function; - GetHashWithValues: Function; - CreateNoncePOWExtern: Function; - CreateNoncePOWExternMinPower: Function; - CreateNoncePOWInner: Function; - CreateAddrPOW: Function; - CalcMerkl3FromArray: Function; - CalcMerkl0FromArray: Function; - ClientHex: Function; - CalcHash3FromArray: Function; - CalcHashFromArray: Function; - CalcMerklFromArray: Function; - CalcTreeHashFromArrBody: Function; - UpdateMerklTree: Function; - GetMerkleProof: Function; - CheckMerkleProof: Function; - IsZeroArr: Function; - GetHashWithNonce: Function; - GetPowPower: Function; - GetArrFromValue: Function; - GetPowValue: Function; - Mesh: Function; - Encrypt: Function; - Decrypt: Function; - toUTF8Array: Function; - Utf8ArrayToStr: Function; - GetArrFromStr: Function; - IsDeveloperAccount: Function; - DEVELOP_PUB_KEY_ARR: Buffer[] | string[]; - DEVELOP_PUB_KEY: any; - DEVELOP_PUB_KEY0: Buffer; - ARR_PUB_KEY: any; - //#endregion + // //#region crypto-library.ts + // MAX_SUPER_VALUE_POW: number; + // GetHexFromAddres: Function; + // GetArr32FromHex: Function; + // GetAddresFromHex: Function; + // GetHexAddresFromPublicKey: Function; + // GetHexFromArr: Function; + // GetArrFromHex: Function; + // GetHexFromArrBlock: Function; + // GetPublicKeyFromAddres: Function; + // CheckDevelopSign: Function; + // CheckContextSecret: Function; + // GetSignHash: Function; + // GetVerifyHash: Function; + // GetKeyPair: Function; + // GetKeyPairTest: Function; + // GetHashWithValues: Function; + // CreateNoncePOWExtern: Function; + // CreateNoncePOWExternMinPower: Function; + // CreateNoncePOWInner: Function; + // CreateAddrPOW: Function; + // CalcMerkl3FromArray: Function; + // CalcMerkl0FromArray: Function; + // ClientHex: Function; + // CalcHash3FromArray: Function; + // CalcHashFromArray: Function; + // CalcMerklFromArray: Function; + // CalcTreeHashFromArrBody: Function; + // UpdateMerklTree: Function; + // GetMerkleProof: Function; + // CheckMerkleProof: Function; + // IsZeroArr: Function; + // GetHashWithNonce: Function; + // GetPowPower: Function; + // GetArrFromValue: Function; + // GetPowValue: Function; + // Mesh: Function; + // Encrypt: Function; + // Decrypt: Function; + // toUTF8Array: Function; + // Utf8ArrayToStr: Function; + // GetArrFromStr: Function; + // IsDeveloperAccount: Function; + // DEVELOP_PUB_KEY_ARR: Buffer[] | string[]; + // DEVELOP_PUB_KEY: any; + // DEVELOP_PUB_KEY0: Buffer; + // ARR_PUB_KEY: any; + // //#endregion //#region log-strict.ts CheckSizeLogFile: Function;