Browse Source

Test

patch-3
jl777 7 years ago
parent
commit
bac6fff574
  1. 14
      iguana/exchanges/LP_rpc.c
  2. 2
      iguana/exchanges/LP_utxo.c

14
iguana/exchanges/LP_rpc.c

@ -49,8 +49,8 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
// bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction" // bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction"
if ( coin != 0 ) if ( coin != 0 )
{ {
if ( strcmp(method,"listunspent") == 0 ) //if ( strcmp(method,"listunspent") == 0 )
printf("issue.(%s, %s, %s, %s, %s)\n",coin->symbol,coin->serverport,coin->userpass,method,params); // printf("issue.(%s, %s, %s, %s, %s)\n",coin->symbol,coin->serverport,coin->userpass,method,params);
if ( coin->electrum != 0 && (strcmp(method,"getblock") == 0 || strcmp(method,"paxprice") == 0 || strcmp(method,"getrawmempool") == 0) ) if ( coin->electrum != 0 && (strcmp(method,"getblock") == 0 || strcmp(method,"paxprice") == 0 || strcmp(method,"getrawmempool") == 0) )
return(cJSON_Parse("{\"error\":\"illegal electrum call\"}")); return(cJSON_Parse("{\"error\":\"illegal electrum call\"}"));
if ( coin->inactive == 0 || strcmp(method,"importprivkey") == 0 || strcmp(method,"validateaddress") == 0 || strcmp(method,"getrawtransaction") == 0 || strcmp(method,"getblock") == 0 || strcmp(method,"getinfo") == 0 || strcmp(method,"getblockchaininfo") == 0 ) if ( coin->inactive == 0 || strcmp(method,"importprivkey") == 0 || strcmp(method,"validateaddress") == 0 || strcmp(method,"getrawtransaction") == 0 || strcmp(method,"getblock") == 0 || strcmp(method,"getinfo") == 0 || strcmp(method,"getblockchaininfo") == 0 )
@ -60,9 +60,9 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params); retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params);
if ( retstr != 0 && retstr[0] != 0 ) if ( retstr != 0 && retstr[0] != 0 )
{ {
if ( strcmp(method,"listunspent") == 0 ) //if ( strcmp(method,"listunspent") == 0 )
printf("%s.(%s %s): %s.%s -> (%s)\n",coin->symbol,coin->serverport,coin->userpass,method,params,retstr); // printf("%s.(%s %s): %s.%s -> (%s)\n",coin->symbol,coin->serverport,coin->userpass,method,params,retstr);
retjson = cJSON_Parse(retstr); retjson = cJSON_Parse(retstr);
free(retstr); free(retstr);
} }
} }
@ -437,7 +437,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr,bits256 reftxid,bits256 reftxi
else numconfs = 1; else numconfs = 1;
sprintf(buf,"[%d, 99999999, [\"%s\"]]",numconfs,coinaddr); sprintf(buf,"[%d, 99999999, [\"%s\"]]",numconfs,coinaddr);
retjson = bitcoin_json(coin,"listunspent",buf); retjson = bitcoin_json(coin,"listunspent",buf);
printf("LP_listunspent.(%s %s) -> %s\n",symbol,buf,jprint(retjson,0)); //printf("LP_listunspent.(%s %s) -> %s\n",symbol,buf,jprint(retjson,0));
if ( (n= cJSON_GetArraySize(retjson)) > 0 ) if ( (n= cJSON_GetArraySize(retjson)) > 0 )
{ {
char str[65]; char str[65];
@ -451,7 +451,7 @@ printf("LP_listunspent.(%s %s) -> %s\n",symbol,buf,jprint(retjson,0));
{ {
jaddi(array,jduplicate(item)); jaddi(array,jduplicate(item));
free_json(txjson); free_json(txjson);
} else printf("%s/v%d is spent\n",bits256_str(str,txid),vout); } //else printf("%s/v%d is spent\n",bits256_str(str,txid),vout);
} }
free_json(retjson); free_json(retjson);
retjson = array; retjson = array;

2
iguana/exchanges/LP_utxo.c

@ -548,7 +548,7 @@ struct LP_address *LP_address_utxo_reset(int32_t *nump,struct iguana_info *coin)
portable_mutex_lock(&coin->addressutxo_mutex); portable_mutex_lock(&coin->addressutxo_mutex);
if ( (array= LP_listunspent(coin->symbol,coin->smartaddr,zero,zero)) != 0 ) if ( (array= LP_listunspent(coin->symbol,coin->smartaddr,zero,zero)) != 0 )
{ {
printf("%s array.%s\n",coin->symbol,jprint(array,0)); //printf("%s array.%s\n",coin->symbol,jprint(array,0));
portable_mutex_lock(&coin->addrmutex); portable_mutex_lock(&coin->addrmutex);
portable_mutex_lock(&LP_gcmutex); portable_mutex_lock(&LP_gcmutex);
DL_FOREACH_SAFE(ap->utxos,up,tmp) DL_FOREACH_SAFE(ap->utxos,up,tmp)

Loading…
Cancel
Save