Test
This commit is contained in:
@@ -346,6 +346,39 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
|||||||
return(retstr2);
|
return(retstr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t notarizedtxid_height(char *txidstr,int32_t *kmdnotarized_heightp)
|
||||||
|
{
|
||||||
|
char *jsonstr,params[256]; int32_t height = 0,txid_height = 0,confirmations = 0;
|
||||||
|
params[0] = 0;
|
||||||
|
*kmdnotarized_heightp = 0;
|
||||||
|
if ( KMDUSERPASS[0] != 0 )
|
||||||
|
{
|
||||||
|
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getinfo",params,7771)) != 0 )
|
||||||
|
{
|
||||||
|
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||||
|
{
|
||||||
|
*kmdnotarized_heightp = jint(json,"notarized");
|
||||||
|
height = jint(json,"blocks");
|
||||||
|
free_json(json);
|
||||||
|
}
|
||||||
|
free(jsonstr);
|
||||||
|
}
|
||||||
|
sprintf(params,"[\"%s\", 1]",txidstr);
|
||||||
|
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771)) != 0 )
|
||||||
|
{
|
||||||
|
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||||
|
{
|
||||||
|
confirmations = jint(json,"confirmations");
|
||||||
|
if ( confirmations > 0 && height > confirmations )
|
||||||
|
txid_height = height - txid_confirmations;
|
||||||
|
free_json(json);
|
||||||
|
}
|
||||||
|
free(jsonstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(txid_height);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t komodo_verifynotarizedscript(int32_t height,uint8_t *script,int32_t len,uint256 NOTARIZED_HASH)
|
int32_t komodo_verifynotarizedscript(int32_t height,uint8_t *script,int32_t len,uint256 NOTARIZED_HASH)
|
||||||
{
|
{
|
||||||
int32_t i; uint256 hash; char params[256];
|
int32_t i; uint256 hash; char params[256];
|
||||||
|
|||||||
@@ -703,11 +703,11 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
if ( mids[j] == -1 )
|
if ( mids[j] == -1 )
|
||||||
gpucount++;
|
gpucount++;
|
||||||
}
|
}
|
||||||
if ( gpucount > j/3 )
|
if ( gpucount > j/2 )
|
||||||
{
|
{
|
||||||
double delta;
|
double delta;
|
||||||
i = ((Mining_height + notaryid) % 64);
|
i = ((Mining_height + notaryid) % 64);
|
||||||
delta = sqrt((double)gpucount - j/3) / 2.;
|
delta = sqrt((double)gpucount - j/2) / 2.;
|
||||||
roundrobin_delay += ((delta * i) / 64) - delta;
|
roundrobin_delay += ((delta * i) / 64) - delta;
|
||||||
//fprintf(stderr,"delta.%f %f %f\n",delta,(double)(gpucount - j/3) / 2,(delta * i) / 64);
|
//fprintf(stderr,"delta.%f %f %f\n",delta,(double)(gpucount - j/3) / 2,(delta * i) / 64);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ int32_t komodo_longestchain();
|
|||||||
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
|
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
|
||||||
int32_t komodo_whoami(char *pubkeystr,int32_t height);
|
int32_t komodo_whoami(char *pubkeystr,int32_t height);
|
||||||
extern int32_t KOMODO_LASTMINED;
|
extern int32_t KOMODO_LASTMINED;
|
||||||
|
extern char ASSETCHAINS_SYMBOL[];
|
||||||
|
int32_t notarizedtxid_height(char *txidstr,int32_t *kmdnotarized_heightp);
|
||||||
|
#define KOMODO_VERSION "0.1.0"
|
||||||
|
|
||||||
Value getinfo(const Array& params, bool fHelp)
|
Value getinfo(const Array& params, bool fHelp)
|
||||||
{
|
{
|
||||||
@@ -92,14 +95,24 @@ Value getinfo(const Array& params, bool fHelp)
|
|||||||
Object obj;
|
Object obj;
|
||||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||||
|
obj.push_back(Pair("KMDversion", KOMODO_VERSION));
|
||||||
obj.push_back(Pair("notarized", notarized_height));
|
obj.push_back(Pair("notarized", notarized_height));
|
||||||
obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
|
obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
|
||||||
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
|
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
{
|
||||||
|
int32_t kmdnotarized_height,txid_height;
|
||||||
|
txid_height = notarizedtxid_height(notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||||
|
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||||
|
obj.push_back(Pair("kmdnotarized_height", kmdnotarized_height));
|
||||||
|
obj.push_back(Pair("notarized_confirms", kmdnotarized_height));
|
||||||
|
}
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (pwalletMain) {
|
if (pwalletMain) {
|
||||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||||
obj.push_back(Pair("interest", ValueFromAmount(komodo_interestsum())));
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
obj.push_back(Pair("interest", ValueFromAmount(komodo_interestsum())));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||||
|
|||||||
Reference in New Issue
Block a user