|
|
@ -50,7 +50,7 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin) |
|
|
|
{ |
|
|
|
buf[0] = 0; |
|
|
|
retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr); |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -274,7 +274,7 @@ cJSON *dpow_MoMoMdata(struct iguana_info *coin,char *symbol,int32_t kmdheight,ui |
|
|
|
printf("%s kmdheight.%d CCid.%u MoMoM.%s -> %s\n",symbol,kmdheight,CCid,buf,retstr); |
|
|
|
free(retstr); |
|
|
|
} |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
return(retjson); |
|
|
|
} |
|
|
@ -350,7 +350,7 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin, |
|
|
|
sprintf(buf,"%d",height); |
|
|
|
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblockhash",buf); |
|
|
|
//printf("%s ht.%d -> getblockhash.(%s)\n",coin->symbol,height,retstr);
|
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -412,7 +412,7 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2 |
|
|
|
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblock",buf); |
|
|
|
if ( 0 && strcmp(coin->symbol,"USD") == 0 ) |
|
|
|
printf("%s getblock.(%s)\n",coin->symbol,retstr); |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -458,7 +458,7 @@ char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin |
|
|
|
} |
|
|
|
free_json(retjson); |
|
|
|
} |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -478,7 +478,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 |
|
|
|
if ( coin->FULLNODE < 0 ) |
|
|
|
{ |
|
|
|
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf); |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -509,7 +509,7 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info |
|
|
|
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"decoderawtransaction",paramstr); |
|
|
|
//printf("%s decoderawtransaction.(%s) <- (%s)\n",coin->symbol,retstr,paramstr);
|
|
|
|
free(paramstr); |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -531,7 +531,7 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin |
|
|
|
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 ) |
|
|
|
{ |
|
|
|
} |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
|
{ |
|
|
@ -648,7 +648,7 @@ char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *c |
|
|
|
} |
|
|
|
//printf("%s signrawtransaction.(%s) params.(%s)\n",coin->symbol,retstr,paramstr);
|
|
|
|
free(paramstr); |
|
|
|
usleep(10000); |
|
|
|
usleep(1000); |
|
|
|
return(retstr); |
|
|
|
} |
|
|
|
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) |
|
|
@ -952,22 +952,17 @@ int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits |
|
|
|
{ |
|
|
|
if ( (n= cJSON_GetArraySize(unspents)) > 0 ) |
|
|
|
{ |
|
|
|
/*{
|
|
|
|
"txid" : "34bc21b40d6baf38e2db5be5353dd0bcc9fe416485a2a68753541ed2f9c194b1", |
|
|
|
"vout" : 0, |
|
|
|
"address" : "RFBmvBaRybj9io1UpgWM4pzgufc3E4yza7", |
|
|
|
"scriptPubKey" : "21039a3f7373ae91588b9edd76a9088b2871f62f3438d172b9f18e0581f64887404aac", |
|
|
|
"amount" : 3.00000000, |
|
|
|
"confirmations" : 4282, |
|
|
|
"spendable" : true |
|
|
|
},*/ |
|
|
|
//r = 0;
|
|
|
|
//memcpy(&r,coin->symbol,3);
|
|
|
|
//r = calc_crc32(0,(void *)&r,sizeof(r));
|
|
|
|
OS_randombytes((uint8_t *)&r,sizeof(r)); |
|
|
|
for (j=0; j<n; j++) |
|
|
|
j=0; |
|
|
|
while (haveutxo < 1) |
|
|
|
{ |
|
|
|
i = (r + j) % n; |
|
|
|
j++; |
|
|
|
if (j == n) { |
|
|
|
haveutxo=0; |
|
|
|
break; |
|
|
|
} |
|
|
|
OS_randombytes((uint8_t *)&r,sizeof(r)); |
|
|
|
i = r % n; |
|
|
|
printf("[%s] : chosen = %d out of %d loop.(%d)\n",coin->symbol,i,n,j); |
|
|
|
if ( (item= jitem(unspents,i)) == 0 ) |
|
|
|
continue; |
|
|
|
if ( is_cJSON_False(jobj(item,"spendable")) != 0 ) |
|
|
|