Browse Source

test

etomic
jl777 8 years ago
parent
commit
061eea05e9
  1. 6
      basilisk/basilisk_DEX.c
  2. 10
      basilisk/basilisk_swap.c

6
basilisk/basilisk_DEX.c

@ -117,16 +117,16 @@ int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_r
memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest); memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest);
} }
if ( rp->quoteid != 0 && basilisk_quoteid(rp) != rp->quoteid ) if ( rp->quoteid != 0 && basilisk_quoteid(rp) != rp->quoteid )
printf(" basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u\n",rwflag,rp->quoteid,basilisk_quoteid(rp)); printf(" basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u rp.%p\n",rwflag,rp->quoteid,basilisk_quoteid(rp),rp);
if ( basilisk_requestid(rp) != rp->requestid ) if ( basilisk_requestid(rp) != rp->requestid )
printf(" basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u\n",rwflag,rp->requestid,basilisk_requestid(rp)); printf(" basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u rp.%p\n",rwflag,rp->requestid,basilisk_requestid(rp),rp);
return(len); return(len);
} }
uint32_t basilisk_request_enqueue(struct supernet_info *myinfo,struct basilisk_request *rp) uint32_t basilisk_request_enqueue(struct supernet_info *myinfo,struct basilisk_request *rp)
{ {
uint8_t serialized[256]; int32_t len; struct queueitem *item; uint8_t serialized[256]; int32_t len; struct queueitem *item;
printf("basilisk_request_enqueue\n"); printf(" basilisk_request_enqueue\n");
len = basilisk_rwDEXquote(1,serialized+1,rp); len = basilisk_rwDEXquote(1,serialized+1,rp);
if ( (item= calloc(1,sizeof(*item) + len + 1)) != 0 ) if ( (item= calloc(1,sizeof(*item) + len + 1)) != 0 )
{ {

10
basilisk/basilisk_swap.c

@ -1844,7 +1844,7 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct
int32_t i,m,n; uint32_t channel,starttime; cJSON *retarray,*item,*msgobj; struct basilisk_swap *swap = 0; int32_t i,m,n; uint32_t channel,starttime; cJSON *retarray,*item,*msgobj; struct basilisk_swap *swap = 0;
for (i=0; i<sizeof(*rp); i++) for (i=0; i<sizeof(*rp); i++)
printf("%02x",((uint8_t *)rp)[i]); printf("%02x",((uint8_t *)rp)[i]);
printf(" thread start\n"); printf(" thread start %p\n",rp);
portable_mutex_lock(&myinfo->DEX_swapmutex); portable_mutex_lock(&myinfo->DEX_swapmutex);
for (i=0; i<myinfo->numswaps; i++) for (i=0; i<myinfo->numswaps; i++)
if ( myinfo->swaps[i]->I.req.requestid == rp->requestid ) if ( myinfo->swaps[i]->I.req.requestid == rp->requestid )
@ -1858,7 +1858,9 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct
vcalc_sha256(0,swap->I.orderhash.bytes,(uint8_t *)rp,sizeof(*rp)); vcalc_sha256(0,swap->I.orderhash.bytes,(uint8_t *)rp,sizeof(*rp));
swap->I.req = *rp; swap->I.req = *rp;
swap->myinfo = myinfo; swap->myinfo = myinfo;
printf("START swap requestid.%u\n",rp->requestid); for (i=0; i<sizeof(swap->I.req); i++)
fprintf(stderr,"%02x",((uint8_t *)&swap->I.req)[i]);
fprintf(stderr,"START swap requestid.%u %p\n",rp->requestid,&swap->I.req);
m = n = 0; m = n = 0;
if ( bitcoin_swapinit(myinfo,swap,optionduration) != 0 ) if ( bitcoin_swapinit(myinfo,swap,optionduration) != 0 )
{ {
@ -1890,8 +1892,8 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct
if ( statebits != 0 || m > n/2 ) if ( statebits != 0 || m > n/2 )
{ {
for (i=0; i<sizeof(swap->I.req); i++) for (i=0; i<sizeof(swap->I.req); i++)
printf("%02x",((uint8_t *)&swap->I.req)[i]); fprintf(stderr,"%02x",((uint8_t *)&swap->I.req)[i]);
fprintf(stderr," m.%d n.%d launch.%d %d\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps))); fprintf(stderr," M.%d N.%d launch.%d %d %p\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps)),&swap->I.req);
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)basilisk_swaploop,(void *)swap) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)basilisk_swaploop,(void *)swap) != 0 )
{ {

Loading…
Cancel
Save