Browse Source

test

etomic
jl777 8 years ago
parent
commit
a2c1690791
  1. 3
      iguana/dPoW.h
  2. 17
      iguana/dpow/dpow_network.c
  3. 5
      iguana/iguana_notary.c
  4. 2
      iguana/tests/dexsendrawtransaction
  5. 1
      includes/iguana_apideclares.h

3
iguana/dPoW.h

@ -143,7 +143,6 @@ int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp);
void dex_updateclient(struct supernet_info *myinfo); void dex_updateclient(struct supernet_info *myinfo);
char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen); char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen);
char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration); char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration);
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx);
cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout); cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout);
int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin); int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin);
void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen); void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen);
@ -154,11 +153,13 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin
cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash); cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash);
bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height); bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height);
bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin); bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin);
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx);
char *_dex_getinfo(struct supernet_info *myinfo,char *symbol); char *_dex_getinfo(struct supernet_info *myinfo,char *symbol);
char *_dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid); char *_dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid);
char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2); char *_dex_getblock(struct supernet_info *myinfo,char *symbol,bits256 hash2);
char *_dex_getblockhash(struct supernet_info *myinfo,char *symbol,int32_t height); char *_dex_getblockhash(struct supernet_info *myinfo,char *symbol,int32_t height);
char *_dex_getbestblockhash(struct supernet_info *myinfo,char *symbol); char *_dex_getbestblockhash(struct supernet_info *myinfo,char *symbol);
char *_dex_sendrawtransaction(struct supernet_info *myinfo,char *symbol,char *signedtx);
#endif #endif

17
iguana/dpow/dpow_network.c

@ -124,6 +124,10 @@ char *dex_response(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp)
bits256_str(buf,hash2); bits256_str(buf,hash2);
retstr = clonestr(buf); retstr = clonestr(buf);
} }
else if ( dexreq.func == 'S' )
{
retstr = dpow_sendrawtransaction(myinfo,coin,(char *)&dexp->packet[sizeof(dexreq)]);
}
} }
if ( retstr == 0 ) if ( retstr == 0 )
return(clonestr("{\"error\":\"null return\"}")); return(clonestr("{\"error\":\"null return\"}"));
@ -302,6 +306,19 @@ char *_dex_getbestblockhash(struct supernet_info *myinfo,char *symbol)
return(dex_reqsend(myinfo,"request",packet,datalen)); return(dex_reqsend(myinfo,"request",packet,datalen));
} }
char *_dex_sendrawtransaction(struct supernet_info *myinfo,char *symbol,char *signedtx)
{
struct dex_request dexreq; uint8_t *packet; int32_t datalen;
packet = calloc(1,sizeof(dexreq)+strlen(signedtx)+1);
memset(&dexreq,0,sizeof(dexreq));
safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.func = 'S';
datalen = dex_rwrequest(1,packet,&dexreq);
strcpy((char *)&packet[sizeof(dexreq)],signedtx);
datalen += strlen(signedtx) + 1;
return(dex_reqsend(myinfo,"request",packet,datalen));
}
int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32) int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32)
{ {
int32_t i,firstz = -1; int32_t i,firstz = -1;

5
iguana/iguana_notary.c

@ -528,7 +528,10 @@ HASH_AND_STRING(dex,getblock,hash,symbol)
return(_dex_getblock(myinfo,symbol,hash)); return(_dex_getblock(myinfo,symbol,hash));
} }
TWO_STRINGS(dex,sendrawtransaction,symbol,signedtx)
{
return(_dex_sendrawtransaction(myinfo,symbol,signedtx));
}
#include "../includes/iguana_apiundefs.h" #include "../includes/iguana_apiundefs.h"

2
iguana/tests/dexsendrawtransaction

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

1
includes/iguana_apideclares.h

@ -26,6 +26,7 @@ STRING_ARG(dex,getinfo,symbol);
STRING_ARG(dex,getbestblockhash,symbol); STRING_ARG(dex,getbestblockhash,symbol);
STRING_AND_INT(dex,getblockhash,symbol,height); STRING_AND_INT(dex,getblockhash,symbol,height);
HASH_AND_STRING(dex,getblock,hash,symbol); HASH_AND_STRING(dex,getblock,hash,symbol);
TWO_STRINGS(dex,sendrawtransaction,symbol,signedtx);
TWO_STRINGS(zcash,passthru,function,hex); TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex); TWO_STRINGS(komodo,passthru,function,hex);

Loading…
Cancel
Save