forked from circlecloud/tera
		
	@@ -9,6 +9,7 @@
 | 
			
		||||
*/
 | 
			
		||||
let WebApi2: any = {};
 | 
			
		||||
import * as crypto from 'crypto';
 | 
			
		||||
import { TYPE_TRANSACTION } from '../constant/account';
 | 
			
		||||
WebApi2.GenerateKeys = function(Params) {
 | 
			
		||||
    var KeyPair = crypto.createECDH('secp256k1');
 | 
			
		||||
    var PrivKey = global.sha3(crypto.randomBytes(32));
 | 
			
		||||
@@ -21,7 +22,7 @@ WebApi2.CreateAccount = function(Params, response) {
 | 
			
		||||
        var KeyPair = crypto.createECDH('secp256k1');
 | 
			
		||||
        KeyPair.setPrivateKey(Buffer.from(global.GetArrFromHex(Params.PrivKey)));
 | 
			
		||||
        var PubKey = KeyPair.getPublicKey('' as any, 'compressed');
 | 
			
		||||
        var TR: any = { Type: global.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
 | 
			
		||||
        var TR: any = { Type: TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
 | 
			
		||||
        var Body = global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {}, 1);
 | 
			
		||||
        Body = Body.slice(0, Body.len + 12);
 | 
			
		||||
        SendTransaction(Body, TR as any, Params.Wait, function(result, text) {
 | 
			
		||||
@@ -270,7 +271,7 @@ function CreateTxID(body, BlockNum, Nonce) {
 | 
			
		||||
 | 
			
		||||
function GetBlockNumTr(arr) {
 | 
			
		||||
    var BlockNum = DELTA_FOR_TIME_TX + global.GetCurrentBlockNumByTime();
 | 
			
		||||
    if (arr[0] === global.TYPE_TRANSACTION_CREATE) {
 | 
			
		||||
    if (arr[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE) {
 | 
			
		||||
        var BlockNum2 = Math.floor(BlockNum / 10) * 10;
 | 
			
		||||
        if (BlockNum2 < BlockNum)
 | 
			
		||||
            BlockNum2 = BlockNum2 + 10;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,8 +10,8 @@
 | 
			
		||||
 | 
			
		||||
import '../core/constant'
 | 
			
		||||
global.PROCESS_NAME = "MAIN";
 | 
			
		||||
import fs = require('fs');
 | 
			
		||||
import os = require('os');
 | 
			
		||||
import * as fs from 'fs'
 | 
			
		||||
import * as os from 'os'
 | 
			
		||||
// import path = require('path')
 | 
			
		||||
import * as crypto from 'crypto';
 | 
			
		||||
import { secp256k1 } from '../core/library'
 | 
			
		||||
@@ -236,9 +236,8 @@ function StartChildProcess(Item) {
 | 
			
		||||
                    global.ToLog("KILL PROCESS " + ITEM.Name + ": " + ITEM.Worker.pid);
 | 
			
		||||
                    try {
 | 
			
		||||
                        process.kill(ITEM.Worker.pid, 'SIGKILL');
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (e) {
 | 
			
		||||
                        global.ToLog("ERR KILL");
 | 
			
		||||
                    } catch (e) {
 | 
			
		||||
                        global.ToLog("ERR KILL" + e);
 | 
			
		||||
                    }
 | 
			
		||||
                    ITEM.Worker = undefined;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -71,8 +71,7 @@ function StartHashPump(e) {
 | 
			
		||||
    (!global.BlockPump || global.BlockPump.BlockNum < e.BlockNum || global.BlockPump.MinerID !== e.MinerID || global.BlockPump.Percent !== e.Percent) && (global.BlockPump = {
 | 
			
		||||
        BlockNum: e.BlockNum,
 | 
			
		||||
        RunCount: e.RunCount, MinerID: e.MinerID, Percent: e.Percent, LastNonce: 0
 | 
			
		||||
    }), idIntervalPump = idIntervalPump || setInterval(PumpHash,
 | 
			
		||||
        global.POWRunPeriod);
 | 
			
		||||
    }), idIntervalPump = idIntervalPump || setInterval(PumpHash, global.POWRunPeriod);
 | 
			
		||||
};
 | 
			
		||||
var StartTime = 1, EndTime = 0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user