Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a2c69b1de6
  1. 14
      iguana/iguana_rpc.c

14
iguana/iguana_rpc.c

@ -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) 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)); memset(params,0,sizeof(params));
if ( json != 0 ) if ( json != 0 )
{ {
if ( port == myinfo->rpcport ) 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 ) if ( symbol[0] == 0 )
{ {
c = 'B'; c = 'B';
sprintf(symbol,"%c%c%c%c",c,'T',c+1,c+2); 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 else
{ {
@ -662,10 +666,10 @@ char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,ch
if ( i == IGUANA_MAXCOINS ) if ( i == IGUANA_MAXCOINS )
coin = 0; coin = 0;
} }
if ( coin == 0 && symbol != 0 && symbol[0] != 0 ) if ( coin == 0 && symbol[0] != 0 )
coin = iguana_coinfind(symbol); coin = iguana_coinfind(symbol);
//printf("method.(%s) (%s) remote.(%s) symbol.(%s)\n",method,jprint(json,0),remoteaddr,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 ) if ( (array= jarray(&n,json,"params")) == 0 )
{ {

Loading…
Cancel
Save