Browse Source

Test

etomic
jl777 8 years ago
parent
commit
bee18024b5
  1. 6
      basilisk/basilisk_DEX.c
  2. 2
      basilisk/basilisk_swap.c
  3. 5
      basilisk/smartaddress.c

6
basilisk/basilisk_DEX.c

@ -242,11 +242,12 @@ char *basilisk_start(struct supernet_info *myinfo,bits256 privkey,struct basilis
cJSON *retjson; char typestr[64]; bits256 tmpprivkey; double bidasks[2]; struct basilisk_request *rp=0; int32_t i,srcmatch,destmatch;
if ( _rp->requestid == myinfo->lastdexrequestid )
{
//printf("filter duplicate r%u\n",_rp->requestid);
printf("filter duplicate r%u\n",_rp->requestid);
return(clonestr("{\"error\":\"filter duplicate requestid\"}"));
}
srcmatch = smartaddress_pubkey(myinfo,typestr,bidasks,&tmpprivkey,_rp->src,_rp->srchash) >= 0;
destmatch = smartaddress_pubkey(myinfo,typestr,bidasks,&tmpprivkey,_rp->dest,_rp->desthash) >= 0;
char str[65],str2[65]; printf("%s srcmatch.%d %s destmatch.%d\n",bits256_str(str,_rp->srchash),srcmatch,bits256_str(str2,_rp->desthash),destmatch);
if ( srcmatch != 0 || destmatch != 0 )
{
for (i=0; i<myinfo->numswaps; i++)
@ -312,7 +313,6 @@ int32_t basilisk_requests_poll(struct supernet_info *myinfo)
myinfo->DEXaccept = issueR;
if ( smartaddress_pubkey(myinfo,typestr,bidasks,&privkey,issueR.src,issueR.srchash) >= 0 )
{
printf("matched dex_smartpubkey\n");
if ( myinfo->DEXtrades > 0 )
{
dex_channelsend(myinfo,issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid)); // 60
@ -322,7 +322,7 @@ int32_t basilisk_requests_poll(struct supernet_info *myinfo)
free(retstr);
}
}
else if ( issueR.requestid != myinfo->lastdexrequestid )//if ( issueR.quoteid == 0 )
else if ( myinfo->IAMLP != 0 && issueR.requestid != myinfo->lastdexrequestid )//if ( issueR.quoteid == 0 )
{
issueR.quoteid = basilisk_quoteid(&issueR);
issueR.desthash = myinfo->myaddr.persistent;

2
basilisk/basilisk_swap.c

@ -1869,7 +1869,7 @@ void basilisk_swap_purge(struct supernet_info *myinfo,struct basilisk_swap *swap
{
int32_t i,n;
// while still in orderbook, wait
return;
//return;
portable_mutex_lock(&myinfo->DEX_swapmutex);
n = myinfo->numswaps;
for (i=0; i<n; i++)

5
basilisk/smartaddress.c

@ -286,6 +286,11 @@ int32_t smartaddress_pubkey(struct supernet_info *myinfo,char *typestr,double *b
int32_t i,j,retval = -1; struct smartaddress *ap;
memset(privkeyp,0,sizeof(*privkeyp));
memset(bidaskp,0,sizeof(*bidaskp) * 2);
if ( bits256_cmp(myinfo->myaddr.persistent,pubkey) == 0 )
{
*privkeyp = myinfo->persistent_priv;
return(myinfo->numsmartaddrs);
}
portable_mutex_lock(&myinfo->smart_mutex);
for (i=0; i<myinfo->numsmartaddrs; i++)
if ( bits256_cmp(myinfo->smartaddrs[i].pubkey,pubkey) == 0 )

Loading…
Cancel
Save