|
|
@ -638,21 +638,25 @@ char *iguana_bitcoinrpc(struct supernet_info *myinfo,uint16_t port,struct iguana |
|
|
|
|
|
|
|
char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr,uint16_t port) |
|
|
|
{ |
|
|
|
cJSON *params[16],*array; struct iguana_info *coin = 0; char *symbol = "BTCD"; int32_t i,c,n; char *retstr = 0; |
|
|
|
cJSON *params[16],*array; struct iguana_info *coin = 0; char symbol[16]; int32_t i,c,n; char *retstr = 0; |
|
|
|
symbol[0] = 0; |
|
|
|
memset(params,0,sizeof(params)); |
|
|
|
if ( json != 0 ) |
|
|
|
{ |
|
|
|
if ( port == myinfo->rpcport ) |
|
|
|
{ |
|
|
|
if ( (symbol= jstr(json,"coin")) == 0 || symbol[0] == 0 ) |
|
|
|
if ( jstr(json,"coin") == 0 ) |
|
|
|
{ |
|
|
|
symbol = myinfo->rpcsymbol; |
|
|
|
strcpy(symbol,myinfo->rpcsymbol); |
|
|
|
if ( symbol[0] == 0 ) |
|
|
|
{ |
|
|
|
c = 'B'; |
|
|
|
sprintf(symbol,"%c%c%c%c",c,'T',c+1,c+2); |
|
|
|
} |
|
|
|
} |
|
|
|
else safecopy(symbol,jstr(json,"coin"),sizeof(symbol)); |
|
|
|
if ( myinfo->rpcsymbol[0] == 0 ) |
|
|
|
strcpy(myinfo->rpcsymbol,symbol); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -662,10 +666,10 @@ char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,ch |
|
|
|
if ( i == IGUANA_MAXCOINS ) |
|
|
|
coin = 0; |
|
|
|
} |
|
|
|
if ( coin == 0 && symbol != 0 && symbol[0] != 0 ) |
|
|
|
if ( coin == 0 && symbol[0] != 0 ) |
|
|
|
coin = iguana_coinfind(symbol); |
|
|
|
//printf("method.(%s) (%s) remote.(%s) symbol.(%s)\n",method,jprint(json,0),remoteaddr,symbol);
|
|
|
|
if ( method != 0 && symbol != 0 && (coin != 0 || (coin= iguana_coinfind(symbol)) != 0) ) |
|
|
|
if ( method != 0 && symbol[0] != 0 && (coin != 0 || (coin= iguana_coinfind(symbol)) != 0) ) |
|
|
|
{ |
|
|
|
if ( (array= jarray(&n,json,"params")) == 0 ) |
|
|
|
{ |
|
|
|