Browse Source

Getinfo -> getblockchaininfo on first error

jl777
jl777 7 years ago
parent
commit
15f101538b
  1. 4
      basilisk/basilisk_bitcoin.c
  2. 24
      iguana/dpow/dpow_rpc.c
  3. 2
      iguana/kmd_lookup.h
  4. 2
      includes/iguana_structs.h

4
basilisk/basilisk_bitcoin.c

@ -26,7 +26,7 @@ char *bitcoin_balance(struct iguana_info *coin,char *coinaddr,int32_t lastheight
{
int32_t i,n,height,maxconf=1<<30; int64_t balance = 0; char params[512],*curlstr; cJSON *array,*retjson,*curljson;
retjson = cJSON_CreateObject();
if ( (curlstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",params)) != 0 )
if ( (curlstr= bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr)) != 0 )
{
if ( (curljson= cJSON_Parse(curlstr)) != 0 )
{
@ -181,7 +181,7 @@ int32_t basilisk_bitcoinscan(struct iguana_info *coin,uint8_t origblockspace[IGU
{
struct iguana_txblock txdata; struct iguana_block B; int32_t len,starti,h,num=0,loadheight,hexlen,datalen,n,i,numtxids,flag=0,j,height=-1; cJSON *curljson,*blockjson,*txids; char *bitstr,*curlstr,params[128],str[65]; struct iguana_msghdr H; struct iguana_msgblock *msg; uint8_t *blockspace,revbits[4],bitsbuf[4]; bits256 hash2,checkhash2;
strcpy(params,"[]");
if ( (curlstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",params)) != 0 )
if ( (curlstr= bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr)) != 0 )
{
if ( (curljson= cJSON_Parse(curlstr)) != 0 )
{

24
iguana/dpow/dpow_rpc.c

@ -15,13 +15,33 @@
#define issue_curl(cmdstr) bitcoind_RPC(0,"curl",cmdstr,0,0,0,0)
char *bitcoind_getinfo(char *symbol,char *serverport,char *userpass,char *getinfostr)
{
char buf[1],*retstr; cJSON *retjson;
buf[0] = 0;
if ( getinfostr[0] == 0 )
strcpy(getinfostr,"getinfo");
retstr = bitcoind_passthru(symbol,serverport,userpass,getinfostr,buf);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( jobj(retjson,"error") != 0 && strcmp(getinfostr,"getinfo") == 0 )
{
strcpy(getinfostr,"getblockchaininfo");
free(retstr);
retstr = bitcoind_passthru(symbol,serverport,userpass,getinfostr,buf);
}
free(retjson);
}
return(retstr);
}
cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{
char buf[128],*retstr=0; cJSON *json = 0;
if ( coin->FULLNODE < 0 )
{
buf[0] = 0;
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",buf);
retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr);
usleep(10000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
@ -1244,7 +1264,7 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
if ( height <= 0 )
height = 1;
*isrealtimep = 0;
if ( (retstr= dpow_issuemethod(coin->chain->userpass,(char *)"getinfo",0,port)) != 0 )
if ( (retstr= dpow_issuemethod(coin->chain->userpass,(char *)coin->getinfostr,0,port)) != 0 )
{
if ( (infoobj= cJSON_Parse(retstr)) != 0 )
{

2
iguana/kmd_lookup.h

@ -354,7 +354,7 @@ int32_t kmd_height(struct iguana_info *coin)
{
char params[64],*curlstr; cJSON *curljson; int32_t height = 0;
strcpy(params,"[]");
if ( (curlstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getinfo",params)) != 0 )
if ( (curlstr= bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr)) != 0 )
{
if ( (curljson= cJSON_Parse(curlstr)) != 0 )
{

2
includes/iguana_structs.h

@ -528,7 +528,7 @@ struct iguana_info
#ifdef DEPRECATED_HHUTXO
struct iguana_hhaccount *accountstable;
#endif
char lastdispstr[2048];
char lastdispstr[2048],getinfostr[64];
double txidfind_totalmillis,txidfind_num,spendtxid_totalmillis,spendtxid_num;
struct iguana_monitorinfo monitoring[256];
int32_t notarychain,didaddresses;

Loading…
Cancel
Save