diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index ec3356c98..708abb34f 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/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); } diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 2c177e665..13acf7414 100755 --- a/iguana/iguana_notary.c +++ b/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" diff --git a/iguana/tests/dexgetT b/iguana/tests/dexgetT new file mode 100755 index 000000000..3b5689fc0 --- /dev/null +++ b/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\"}" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index b5e083a5c..2c3ec351c 100755 --- a/includes/iguana_apideclares.h +++ b/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);