Browse Source

test

etomic
jl777 8 years ago
parent
commit
c999d54b90
  1. 13
      iguana/dpow/dpow_rpc.c
  2. 5
      iguana/iguana_notary.c
  3. 2
      iguana/tests/dexgetT
  4. 1
      includes/iguana_apideclares.h

13
iguana/dpow/dpow_rpc.c

@ -254,14 +254,19 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info
cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid)
{
char buf[128],str[65],*retstr=0,*rawtx=0; cJSON *json = 0;
char buf[128],str[65],*retstr=0,*raw,*rawtx=0; cJSON *rawjson,*json = 0;
if ( coin->FULLNODE < 0 )
{
sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid));
if ( (rawtx= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 )
if ( (raw= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 )
{
retstr = dpow_decoderawtransaction(myinfo,coin,rawtx);
free(rawtx);
if ( (rawjson= cJSON_Parse(raw)) != 0 )
{
if ( (rawtx= jstr(rawjson,"result")) != 0 )
retstr = dpow_decoderawtransaction(myinfo,coin,rawtx);
free_json(rawjson);
}
free(raw);
}
usleep(10000);
}

5
iguana/iguana_notary.c

@ -502,6 +502,11 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified)
}
return(clonestr("{\"result\":\"started ratification\"}"));
}
HASH_AND_STRING(dex,gettransaction,txid,symbol)
{
return(dex_getrawtransaction(myinfo,symbol,txid));
}
#include "../includes/iguana_apiundefs.h"

2
iguana/tests/dexgetT

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"gettransaction\",\"txid\":\"aa82ebd1c5bd2a9e19214cbc959df1745378676fddfd6f4903930ac16485c7ae\",\"symbol\":\"BTC\"}"

1
includes/iguana_apideclares.h

@ -21,6 +21,7 @@ ZERO_ARGS(dpow,cancelratify);
THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr);
TWO_STRINGS(dex,send,hex,handler);
HASH_AND_STRING(dex,gettransaction,txid,symbol);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);

Loading…
Cancel
Save