Browse Source

Merge pull request #798 from jl777/jl777

Jl777
patch-3
jl777 7 years ago
committed by GitHub
parent
commit
f88b25c046
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      iguana/exchanges/LP_coins.c
  2. 12
      iguana/exchanges/LP_rpc.c

3
iguana/exchanges/LP_coins.c

@ -367,6 +367,9 @@ struct iguana_info *LP_coinadd(struct iguana_info *cdata)
portable_mutex_lock(&LP_coinmutex); portable_mutex_lock(&LP_coinmutex);
HASH_ADD_KEYPTR(hh,LP_coins,coin->symbol,strlen(coin->symbol),coin); HASH_ADD_KEYPTR(hh,LP_coins,coin->symbol,strlen(coin->symbol),coin);
portable_mutex_unlock(&LP_coinmutex); portable_mutex_unlock(&LP_coinmutex);
strcpy(coin->validateaddress,"validateaddress");
strcpy(coin->getinfostr,"getinfo");
strcpy(coin->estimatefeestr,"estimatefee");
return(coin); return(coin);
} }

12
iguana/exchanges/LP_rpc.c

@ -53,7 +53,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
// 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,"getaddressinfo") == 0 || strcmp(method,"getrawtransaction") == 0 || strcmp(method,"getblock") == 0 || strcmp(method,"getinfo") == 0 || strcmp(method,"getblockchaininfo") == 0 ) if ( coin->inactive == 0 || strcmp(method,"getrawtransaction") == 0 || strcmp(method,"getblock") == 0 || strcmp(method,"getinfo") == 0 || strcmp(method,"getblockchaininfo") == 0 || strcmp(method,"importprivkey") == 0 || strcmp(method,"validateaddress") == 0 || strcmp(method,"getaddressinfo") == 0 || strcmp(method,"importaddress") == 0 )
{ {
if ( coin->electrum == 0 ) if ( coin->electrum == 0 )
{ {
@ -77,7 +77,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
} }
} }
} }
} else retjson = cJSON_Parse("{\"result\":\"disabled\"}"); } //else retjson = cJSON_Parse("{\"result\":\"disabled\"}");
} else printf("bitcoin_json cant talk to NULL coin\n"); } else printf("bitcoin_json cant talk to NULL coin\n");
return(retjson); return(retjson);
} }
@ -344,11 +344,13 @@ cJSON *LP_validateaddress(char *symbol,char *address)
else else
{ {
sprintf(buf,"[\"%s\"]",address); sprintf(buf,"[\"%s\"]",address);
if ( coin->validateaddress[0] == 0 )
strcpy(coin->validateaddress,"validateaddress");
if ( (retjson= bitcoin_json(coin,coin->validateaddress,buf)) != 0 ) if ( (retjson= bitcoin_json(coin,coin->validateaddress,buf)) != 0 )
{ {
if ( jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) if ( jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 )
{ {
printf("autochange validateaddress -> getaddressinfo\n",coin->symbol); printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol);
strcpy(coin->validateaddress,"getaddressinfo"); strcpy(coin->validateaddress,"getaddressinfo");
free(retjson); free(retjson);
return(bitcoin_json(coin,coin->validateaddress,buf)); return(bitcoin_json(coin,coin->validateaddress,buf));
@ -639,7 +641,7 @@ int32_t LP_importaddress(char *symbol,char *address)
sprintf(buf,"[\"%s\", \"%s\", false]",address,address); sprintf(buf,"[\"%s\", \"%s\", false]",address,address);
if ( (retstr= bitcoind_passthru(symbol,coin->serverport,coin->userpass,"importaddress",buf)) != 0 ) if ( (retstr= bitcoind_passthru(symbol,coin->serverport,coin->userpass,"importaddress",buf)) != 0 )
{ {
//printf("importaddress.(%s %s) -> (%s)\n",symbol,address,retstr); printf("importaddress.(%s %s) -> (%s)\n",symbol,address,retstr);
free(retstr); free(retstr);
} //else printf("importaddress.(%s %s)\n",symbol,address); } //else printf("importaddress.(%s %s)\n",symbol,address);
return(1); return(1);

Loading…
Cancel
Save