0.886
This commit is contained in:
@@ -1300,7 +1300,6 @@ function ParseFileName(Str)
|
||||
}
|
||||
return Ret;
|
||||
};
|
||||
var glTrSendNum = 0;
|
||||
window.MapSendTransaction = {};
|
||||
|
||||
function SendTransaction(Body,TR,SumPow,F)
|
||||
@@ -1313,7 +1312,6 @@ function SendTransaction(Body,TR,SumPow,F)
|
||||
F(1, TR, Body);
|
||||
return ;
|
||||
}
|
||||
glTrSendNum++;
|
||||
if(window.SetStatus)
|
||||
SetStatus("Prepare to sending...");
|
||||
CreateNonceAndSend(1, 0, 0);
|
||||
@@ -1322,10 +1320,9 @@ function CreateNonceAndSend(bCreateNonce,startnonce,NumNext)
|
||||
{
|
||||
if(!NumNext)
|
||||
NumNext = 0;
|
||||
var CurTrNum = glTrSendNum;
|
||||
var nonce = startnonce;
|
||||
if(bCreateNonce)
|
||||
nonce = CreateHashBodyPOWInnerMinPower(Body, SumPow);
|
||||
nonce = CreateHashBodyPOWInnerMinPower(Body, SumPow, startnonce);
|
||||
var StrHex = GetHexFromArr(Body);
|
||||
if(NumNext > 10)
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ window.SetBlockChainConstant = function (Data)
|
||||
Data.DELTA_CURRENT_TIME = 0;
|
||||
window.DELTA_CURRENT_TIME2 = Data.DELTA_CURRENT_TIME - DeltaServerClient;
|
||||
window.MIN_POWER_POW_TR = DELTA_POWER_POW_TR + Data.MIN_POWER_POW_TR;
|
||||
window.MIN_POWER_POW_ACC_CREATE = Data.MIN_POWER_POW_ACC_CREATE + 3;
|
||||
window.MIN_POWER_POW_ACC_CREATE = Data.MIN_POWER_POW_ACC_CREATE;
|
||||
window.FIRST_TIME_BLOCK = Data.FIRST_TIME_BLOCK;
|
||||
window.CONSENSUS_PERIOD_TIME = Data.CONSENSUS_PERIOD_TIME;
|
||||
window.GetCurrentBlockNumByTime = function ()
|
||||
@@ -143,7 +143,7 @@ var LastCreatePOWTrType = 0;
|
||||
var LastCreatePOWBlockNum = 0;
|
||||
var LastCreatePOWHash = [255, 255, 255, 255];
|
||||
|
||||
function CreateHashBodyPOWInnerMinPower(arr,MinPow)
|
||||
function CreateHashBodyPOWInnerMinPower(arr,MinPow,startnonce)
|
||||
{
|
||||
var TrType = arr[0];
|
||||
var BlockNum = GetBlockNumTr(arr);
|
||||
@@ -151,7 +151,7 @@ function CreateHashBodyPOWInnerMinPower(arr,MinPow)
|
||||
{
|
||||
MinPow = MIN_POWER_POW_TR + Math.log2(arr.length / 128);
|
||||
}
|
||||
var nonce = 0;
|
||||
var nonce = startnonce;
|
||||
while(1)
|
||||
{
|
||||
var arrhash = CreateHashBody(arr, BlockNum, nonce);
|
||||
@@ -265,7 +265,7 @@ function ComputeSecretWithCheck(PubKey,StrPrivKey,F)
|
||||
F(sha3(Result));
|
||||
};
|
||||
|
||||
function ComputeSecret(PubKey,F)
|
||||
function ComputeSecret(Account,PubKey,F)
|
||||
{
|
||||
if(localStorage["idPrivKey"])
|
||||
{
|
||||
@@ -273,7 +273,7 @@ function ComputeSecret(PubKey,F)
|
||||
}
|
||||
else
|
||||
{
|
||||
GetData("GetWalletInfo", {}, function (Data)
|
||||
GetData("GetWalletInfo", {Account:Account}, function (Data)
|
||||
{
|
||||
if(!Data || !Data.result)
|
||||
return ;
|
||||
|
||||
@@ -125,13 +125,15 @@ function OpenLink(Str)
|
||||
SendData({cmd:"OpenLink", Message:Str});
|
||||
};
|
||||
|
||||
function ComputeSecret(PubKey,F)
|
||||
function ComputeSecret(PubKey,F,Account)
|
||||
{
|
||||
if(!INFO.WalletCanSign)
|
||||
{
|
||||
SetError("Pls, open wallet");
|
||||
return 0;
|
||||
}
|
||||
if(!Account && USER_ACCOUNT.length)
|
||||
Account = USER_ACCOUNT[0].Num;
|
||||
if(typeof PubKey === "number")
|
||||
{
|
||||
var AccNum = PubKey;
|
||||
@@ -143,13 +145,13 @@ function ComputeSecret(PubKey,F)
|
||||
}
|
||||
else
|
||||
{
|
||||
SendData({cmd:"ComputeSecret", PubKey:Arr[0].PubKey.data}, F);
|
||||
SendData({cmd:"ComputeSecret", Account:Account, PubKey:Arr[0].PubKey.data}, F);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
SendData({cmd:"ComputeSecret", PubKey:PubKey}, F);
|
||||
SendData({cmd:"ComputeSecret", Account:Account, PubKey:PubKey}, F);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
10
Source/HTML/JS/tx-lib.js
Normal file
10
Source/HTML/JS/tx-lib.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* @project: TERA
|
||||
* @version: Development (beta)
|
||||
* @license: MIT (not for evil)
|
||||
* @copyright: Yuriy Ivanov 2017-2019 [progr76@gmail.com]
|
||||
* Web: https://terafoundation.org
|
||||
* Twitter: https://twitter.com/terafoundation
|
||||
* Telegram: https://web.telegram.org/#/im?p=@terafoundation
|
||||
*/
|
||||
|
||||
@@ -173,8 +173,9 @@ function CreateTransaction(F,CheckErr,Run)
|
||||
}
|
||||
else
|
||||
{
|
||||
ToID = 0;
|
||||
ToPubKey = "";
|
||||
if(CheckErr)
|
||||
SetError("Valid 'Pay to' - required!");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
if(CheckErr && ToID <= 0 && ToPubKey === "" && !AttachItem)
|
||||
|
||||
Reference in New Issue
Block a user