Browse Source

Needjson flag for sendrawtransaction

pass-iguana-arg
jl777 7 years ago
parent
commit
1efa872eb4
  1. 2
      iguana/exchanges/LP_commands.c
  2. 14
      iguana/exchanges/LP_rpc.c

2
iguana/exchanges/LP_commands.c

@ -630,7 +630,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}
else if ( strcmp(method,"sendrawtransaction") == 0 )
{
return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx")));
return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx"),jint(argjson,"needjson")));
}
else if ( strcmp(method,"convaddress") == 0 )
{

14
iguana/exchanges/LP_rpc.c

@ -791,19 +791,19 @@ double LP_getestimatedrate(struct iguana_info *coin)
return(rate);
}
char *LP_sendrawtransaction(char *symbol,char *signedtx)
char *LP_sendrawtransaction(char *symbol,char *signedtx,int32_t needjson)
{
cJSON *array,*errobj; char *paramstr,*tmpstr,*retstr=0; int32_t n,alreadyflag = 0; cJSON *retjson; struct iguana_info *coin;
if ( symbol == 0 || symbol[0] == 0 || signedtx == 0 || signedtx[0] == 0 )
{
printf("LP_sendrawtransaction null symbol %p or signedtx.%p\n",symbol,signedtx);
return(0);
return(clonestr("{\"error\":\"invalid param\"}"));
}
coin = LP_coinfind(symbol);
if ( coin == 0 )
{
printf("LP_sendrawtransaction null coin\n");
return(0);
return(clonestr("{\"error\":\"invalid coin\"}"));
}
if ( coin->electrum == 0 )
{
@ -844,6 +844,14 @@ char *LP_sendrawtransaction(char *symbol,char *signedtx)
}
}
}
if ( needjson != 0 && is_hexstr(retstr,0) > 0 )
{
retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success");
jaddstr(retjson,"txid",retstr);
free(retstr);
retstr = jprint(retjson,1);
}
return(retstr);
}

Loading…
Cancel
Save