Test
This commit is contained in:
@@ -346,14 +346,25 @@ 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)
|
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp)
|
||||||
{
|
{
|
||||||
char *jsonstr,params[256]; cJSON *json,*item; int32_t height = 0,txid_height = 0,txid_confirmations = 0;
|
char *jsonstr,params[256],*userpass; uint16_t port; cJSON *json,*item; int32_t height = 0,txid_height = 0,txid_confirmations = 0;
|
||||||
params[0] = 0;
|
params[0] = 0;
|
||||||
*kmdnotarized_heightp = 0;
|
*kmdnotarized_heightp = 0;
|
||||||
if ( KMDUSERPASS[0] != 0 )
|
if ( strcmp(dest,"KMD") == 0 )
|
||||||
{
|
{
|
||||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getinfo",params,7771)) != 0 )
|
port = 7771;
|
||||||
|
userpass = KMDUSERPASS;
|
||||||
|
}
|
||||||
|
else if ( strcmp(dest,"BTC") == 0 )
|
||||||
|
{
|
||||||
|
port = 8332;
|
||||||
|
userpass = BTCUSERPASS;
|
||||||
|
}
|
||||||
|
else return(0);
|
||||||
|
if ( userpass[0] != 0 )
|
||||||
|
{
|
||||||
|
if ( (jsonstr= komodo_issuemethod(userpass,(char *)"getinfo",params,port)) != 0 )
|
||||||
{
|
{
|
||||||
//printf("(%s)\n",jsonstr);
|
//printf("(%s)\n",jsonstr);
|
||||||
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||||
@@ -368,7 +379,7 @@ int32_t notarizedtxid_height(char *txidstr,int32_t *kmdnotarized_heightp)
|
|||||||
free(jsonstr);
|
free(jsonstr);
|
||||||
}
|
}
|
||||||
sprintf(params,"[\"%s\", 1]",txidstr);
|
sprintf(params,"[\"%s\", 1]",txidstr);
|
||||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771)) != 0 )
|
if ( (jsonstr= komodo_issuemethod(userpass,(char *)"getrawtransaction",params,port)) != 0 )
|
||||||
{
|
{
|
||||||
//printf("(%s)\n",jsonstr);
|
//printf("(%s)\n",jsonstr);
|
||||||
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ 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[];
|
extern char ASSETCHAINS_SYMBOL[];
|
||||||
int32_t notarizedtxid_height(char *txidstr,int32_t *kmdnotarized_heightp);
|
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
||||||
#define KOMODO_VERSION "0.1.0"
|
#define KOMODO_VERSION "0.1.0"
|
||||||
|
|
||||||
Value getinfo(const Array& params, bool fHelp)
|
Value getinfo(const Array& params, bool fHelp)
|
||||||
@@ -102,7 +102,7 @@ Value getinfo(const Array& params, bool fHelp)
|
|||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
int32_t kmdnotarized_height,txid_height;
|
int32_t kmdnotarized_height,txid_height;
|
||||||
txid_height = notarizedtxid_height((char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||||
obj.push_back(Pair("kmdnotarized_height", kmdnotarized_height));
|
obj.push_back(Pair("kmdnotarized_height", kmdnotarized_height));
|
||||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height) : 0));
|
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height) : 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user