Browse Source

Merge branch 'spvdex' of https://github.com/jl777/SuperNET into dev-decker-spvdex

etomic
DeckerSU 7 years ago
parent
commit
d07fa519c6
  1. 8
      iguana/exchanges/LP_nativeDEX.c
  2. 15
      iguana/exchanges/LP_swap.c

8
iguana/exchanges/LP_nativeDEX.c

@ -308,7 +308,11 @@ void command_rpcloop(void *myipaddr)
//if ( LP_mybussock >= 0 ) //if ( LP_mybussock >= 0 )
// nonz += LP_sock_check("BUS",ctx,origipaddr,-1,LP_mybussock); // nonz += LP_sock_check("BUS",ctx,origipaddr,-1,LP_mybussock);
if ( nonz == 0 ) if ( nonz == 0 )
usleep(10000); {
if ( IAMLP != 0 )
usleep(10);
else usleep(1000);
}
} }
} }
@ -520,6 +524,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
break; break;
} }
coin->lastscanht++; coin->lastscanht++;
if ( coin->lastscanht == coin->longestchain+1 )
break;
} }
if ( j < 100 ) if ( j < 100 )
continue; continue;

15
iguana/exchanges/LP_swap.c

@ -674,8 +674,8 @@ int32_t LP_swapwait(uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t
char *retstr; cJSON *retjson=0; uint32_t divisor=8,expiration = (uint32_t)(time(NULL) + duration); char *retstr; cJSON *retjson=0; uint32_t divisor=8,expiration = (uint32_t)(time(NULL) + duration);
printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid); printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid);
sleep(10); sleep(10);
if ( sleeptime < divisor*60 ) //if ( sleeptime < divisor*60 )
sleeptime = divisor * 60; // sleeptime = divisor * 60;
while ( time(NULL) < expiration ) while ( time(NULL) < expiration )
{ {
if ( (retstr= basilisk_swapentry(requestid,quoteid)) != 0 ) if ( (retstr= basilisk_swapentry(requestid,quoteid)) != 0 )
@ -690,9 +690,10 @@ int32_t LP_swapwait(uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t
} }
free(retstr); free(retstr);
} }
sleep(sleeptime/divisor); sleep(sleeptime);
if ( divisor > 1 ) //sleep(sleeptime/divisor);
divisor--; //if ( divisor > 1 )
// divisor--;
} }
if ( retjson != 0 ) if ( retjson != 0 )
{ {
@ -759,7 +760,7 @@ void LP_bobloop(void *_swap)
basilisk_bobpayment_reclaim(swap,swap->I.callduration); basilisk_bobpayment_reclaim(swap,swap->I.callduration);
if ( swap->N.pair >= 0 ) if ( swap->N.pair >= 0 )
nn_close(swap->N.pair), swap->N.pair = -1; nn_close(swap->N.pair), swap->N.pair = -1;
LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,300); LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,30);
} }
} }
} }
@ -823,7 +824,7 @@ void LP_aliceloop(void *_swap)
} }
if ( swap->N.pair >= 0 ) if ( swap->N.pair >= 0 )
nn_close(swap->N.pair), swap->N.pair = -1; nn_close(swap->N.pair), swap->N.pair = -1;
LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,300); LP_swapwait(swap->I.req.requestid,swap->I.req.quoteid,4*3600,30);
} }
} }
} }

Loading…
Cancel
Save