jl777 7 years ago
parent
commit
5093e8771a
  1. 27
      iguana/exchanges/LP_nativeDEX.c
  2. 4
      iguana/exchanges/LP_remember.c

27
iguana/exchanges/LP_nativeDEX.c

@ -509,14 +509,18 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer)
return(posted); return(posted);
} }
void LP_coinsloop(void *myipaddr) void LP_coinsloop(void *_coins)
{ {
struct iguana_info *coin,*ctmp; bits256 zero; int32_t j,nonz; struct iguana_info *coin,*ctmp; bits256 zero; int32_t j,nonz; char *coins = _coins;
while ( 1 ) while ( 1 )
{ {
nonz = 0; nonz = 0;
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{ {
if ( coins[0] != 0 && strcmp(coins,coin->symbol) != 0 )
continue;
else if ( strcmp("BTC",coin->symbol) == 0 )
continue;
memset(&zero,0,sizeof(zero)); memset(&zero,0,sizeof(zero));
if ( coin->inactive != 0 ) if ( coin->inactive != 0 )
continue; continue;
@ -547,7 +551,7 @@ void LP_coinsloop(void *myipaddr)
continue; continue;
} }
//if ( (coin->lastscanht % 1000) == 0 ) //if ( (coin->lastscanht % 1000) == 0 )
printf("%s ref.%d scan.%d to %d, longest.%d\n",coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain); printf("[%s]: %s ref.%d scan.%d to %d, longest.%d\n",coins,coin->symbol,coin->firstrefht,coin->firstscanht,coin->lastscanht,coin->longestchain);
for (j=0; j<1; j++) for (j=0; j<1; j++)
{ {
if ( LP_blockinit(coin,coin->lastscanht) < 0 ) if ( LP_blockinit(coin,coin->lastscanht) < 0 )
@ -910,7 +914,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
LP_initcoins(ctx,pubsock,coinsjson); LP_initcoins(ctx,pubsock,coinsjson);
G.waiting = 1; G.waiting = 1;
LP_passphrase_init(passphrase,jstr(argjson,"gui")); LP_passphrase_init(passphrase,jstr(argjson,"gui"));
if ( IAMLP != 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_psockloop,(void *)&myipaddr) != 0 ) if ( IAMLP != 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_psockloop,(void *)myipaddr) != 0 )
{ {
printf("error launching LP_psockloop for (%s)\n",myipaddr); printf("error launching LP_psockloop for (%s)\n",myipaddr);
exit(-1); exit(-1);
@ -930,27 +934,32 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching stats rpcloop for port.%u\n",myport); printf("error launching stats rpcloop for port.%u\n",myport);
exit(-1); exit(-1);
} }
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)command_rpcloop,(void *)&myipaddr) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)command_rpcloop,(void *)myipaddr) != 0 )
{ {
printf("error launching command_rpcloop for port.%u\n",myport); printf("error launching command_rpcloop for port.%u\n",myport);
exit(-1); exit(-1);
} }
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)queue_loop,(void *)&myipaddr) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)queue_loop,(void *)myipaddr) != 0 )
{ {
printf("error launching queue_loop for port.%u\n",myport); printf("error launching queue_loop for port.%u\n",myport);
exit(-1); exit(-1);
} }
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)prices_loop,(void *)&myipaddr) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)prices_loop,(void *)myipaddr) != 0 )
{ {
printf("error launching prices_loop for port.%u\n",myport); printf("error launching prices_loop for port.%u\n",myport);
exit(-1); exit(-1);
} }
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_coinsloop,(void *)&myipaddr) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_coinsloop,(void *)"") != 0 )
{ {
printf("error launching LP_coinsloop for port.%u\n",myport); printf("error launching LP_coinsloop for port.%u\n",myport);
exit(-1); exit(-1);
} }
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_pubkeysloop,(void *)&myipaddr) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_coinsloop,(void *)"BTC") != 0 )
{
printf("error launching BTC LP_coinsloop for port.%u\n",myport);
exit(-1);
}
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_pubkeysloop,(void *)myipaddr) != 0 )
{ {
printf("error launching LP_pubkeysloop for ctx.%p\n",ctx); printf("error launching LP_pubkeysloop for ctx.%p\n",ctx);
exit(-1); exit(-1);

4
iguana/exchanges/LP_remember.c

@ -1051,7 +1051,9 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
} }
} }
LP_txbytes_update("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],&rswap.txids[BASILISK_BOBRECLAIM],&rswap.paymentspent,&rswap.sentflags[BASILISK_BOBRECLAIM]); LP_txbytes_update("bobreclaim",rswap.bobcoin,rswap.txbytes[BASILISK_BOBRECLAIM],&rswap.txids[BASILISK_BOBRECLAIM],&rswap.paymentspent,&rswap.sentflags[BASILISK_BOBRECLAIM]);
} else printf("bobpayment spent.%d or now.%u < expiration %u\n",flag,(uint32_t)time(NULL),rswap.expiration); }
else if ( flag == 0 )
printf("bobpayment: now.%u < expiration %u\n",(uint32_t)time(NULL),rswap.expiration);
} }
if ( rswap.sentflags[BASILISK_BOBREFUND] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 ) if ( rswap.sentflags[BASILISK_BOBREFUND] == 0 && rswap.sentflags[BASILISK_BOBDEPOSIT] != 0 && bits256_nonz(rswap.txids[BASILISK_BOBDEPOSIT]) != 0 && bits256_nonz(rswap.depositspent) == 0 )
{ {

Loading…
Cancel
Save