Browse Source

test

etomic
jl777 8 years ago
parent
commit
6b787d9150
  1. 4
      basilisk/basilisk.c
  2. 4
      basilisk/basilisk_MSG.c
  3. 2
      iguana/dPoW.h
  4. 4
      iguana/dpow/dpow_network.c
  5. 6
      iguana/iguana_notary.c
  6. 2
      includes/iguana_apideclares.h

4
basilisk/basilisk.c

@ -900,8 +900,8 @@ void basilisks_loop(void *arg)
endmilli = startmilli + 1000;
else endmilli = startmilli + 2000;
}
//if ( myinfo->expiration != 0 && (myinfo->IAMLP != 0 || myinfo->DEXactive > time(NULL)) )
// basilisk_requests_poll(myinfo);
if ( myinfo->expiration != 0 && (myinfo->dexsock >= 0 || myinfo->IAMLP != 0 || myinfo->DEXactive > time(NULL)) )
basilisk_requests_poll(myinfo);
//printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,OS_milliseconds());
while ( OS_milliseconds() < endmilli )
usleep(10000);

4
basilisk/basilisk_MSG.c

@ -277,7 +277,7 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
jdelete(vals,"msgid");
jaddnum(vals,"msgid",msgid);
}
if ( myinfo->NOTARY.RELAYID >= 0 )
if ( myinfo->NOTARY.RELAYID >= 0 || myinfo->dexsock >= 0 )
{
channel = juint(vals,"channel");
width = juint(vals,"width");
@ -308,7 +308,7 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
if ( vals != 0 && juint(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2));
if ( data != 0 && datalen != 0 )
dex_reqsend(myinfo,space,datalen+BASILISK_KEYSIZE);
dex_reqsend(myinfo,"DEX",space,datalen+BASILISK_KEYSIZE);
return(basilisk_standardservice("OUT",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,0));
}
#include "../includes/iguana_apiundefs.h"

2
iguana/dPoW.h

@ -141,7 +141,7 @@ struct dpow_info
uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp);
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp);
void dex_updateclient(struct supernet_info *myinfo);
int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen);
int32_t 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 *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);

4
iguana/dpow/dpow_network.c

@ -19,6 +19,7 @@
struct dex_nanomsghdr
{
uint32_t crc32,size,datalen,timestamp;
char handler[8];
uint8_t version0,version1,packet[];
} PACKED;
@ -67,7 +68,7 @@ void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t
}
}
int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen)
int32_t dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen)
{
struct dex_nanomsghdr *dexp; char ipaddr[64],str[128]; int32_t retval=0,timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits;
portable_mutex_lock(&myinfo->dexmutex);
@ -115,6 +116,7 @@ int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen)
{
size = (int32_t)(sizeof(*dexp) + datalen);
dexp = calloc(1,size); // endian dependent!
safecopy(dexp->handler,handler,sizeof(dexp->handler));
dexp->size = size;
dexp->datalen = datalen;
dexp->timestamp = (uint32_t)time(NULL);

6
iguana/iguana_notary.c

@ -345,14 +345,16 @@ THREE_STRINGS(iguana,passthru,asset,function,hex)
}
STRING_ARG(dex,send,hex)
TWO_STRINGS(dex,send,hex,handler)
{
uint8_t data[8192]; int32_t datalen,retval;
if ( hex != 0 && (datalen= is_hexstr(hex,0)) > 0 && (datalen>>1) < sizeof(data) )
{
datalen >>= 1;
decode_hex(data,datalen,hex);
if ( (retval= dex_reqsend(myinfo,data,datalen)) == 0 )
if ( handler == 0 || handler[0] == 0 )
handler = "DEX";
if ( (retval= dex_reqsend(myinfo,handler,data,datalen)) == 0 )
return(clonestr("{\"result\":\"success\"}"));
else return(clonestr("{\"error\":\"dex send: retval error\"}"));
} else return(clonestr("{\"error\":\"dex send: invalid hex\"}"));

2
includes/iguana_apideclares.h

@ -20,7 +20,7 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified);
ZERO_ARGS(dpow,cancelratify);
THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr);
STRING_ARG(dex,send,hex);
TWO_STRINGS(dex,send,hex,handler);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);

Loading…
Cancel
Save