Browse Source

Test

etomic
jl777 7 years ago
parent
commit
b3342b3322
  1. 2
      iguana/exchanges/LP_commands.c
  2. 13
      iguana/exchanges/LP_nativeDEX.c
  3. 12
      iguana/exchanges/LP_signatures.c

2
iguana/exchanges/LP_commands.c

@ -593,6 +593,8 @@ bot_resume(botid)\n\
if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_privkey) != 0 )
{
printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr);
if ( ptr->lastpushtime > 0 && ptr->addr_listunspent_requested > (uint32_t)time(NULL)-10 )
ptr->lastpushtime -= LP_ORDERBOOK_DURATION*0.1;
ptr->addr_listunspent_requested = (uint32_t)time(NULL);
}
}

13
iguana/exchanges/LP_nativeDEX.c

@ -603,22 +603,23 @@ void LP_coinsloop(void *_coins)
int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubsock,char *pushaddr,uint16_t myport)
{
static uint32_t counter;//,numpeers;
struct iguana_info *coin,*ctmp; char *origipaddr; int32_t height,nonz = 0;//struct LP_peerinfo *peer,*tmp; uint32_t now;
static uint32_t counter;
struct iguana_info *coin,*ctmp; char *origipaddr; uint32_t now; int32_t height,nonz = 0;
if ( (origipaddr= myipaddr) == 0 )
origipaddr = "127.0.0.1";
if ( mypeer == 0 )
myipaddr = "127.0.0.1";
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{
if ( coin->addr_listunspent_requested != 0 && time(NULL) > coin->lastpushtime+LP_ORDERBOOK_DURATION )
now = (uint32_t)time(NULL);
if ( (coin->addr_listunspent_requested != 0 && now > coin->lastpushtime+LP_ORDERBOOK_DURATION*.5) || now > coin->lastpushtime+LP_ORDERBOOK_DURATION*5 )
{
//printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested);
coin->lastpushtime = (uint32_t)time(NULL);
coin->lastpushtime = (uint32_t)now;
LP_smartutxos_push(coin);
coin->addr_listunspent_requested = 0;
}
if ( coin->electrum == 0 && coin->inactive == 0 && time(NULL) > coin->lastgetinfo+LP_GETINFO_INCR )
if ( coin->electrum == 0 && coin->inactive == 0 && now > coin->lastgetinfo+LP_GETINFO_INCR )
{
nonz++;
if ( (height= LP_getheight(coin)) > coin->longestchain )
@ -627,7 +628,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( 0 && coin->firstrefht != 0 )
printf(">>>>>>>>>> set %s longestchain %d (ref.%d [%d, %d])\n",coin->symbol,height,coin->firstrefht,coin->firstscanht,coin->lastscanht);
} //else LP_mempoolscan(coin->symbol,zero);
coin->lastgetinfo = (uint32_t)time(NULL);
coin->lastgetinfo = (uint32_t)now;
}
}
counter++;

12
iguana/exchanges/LP_signatures.c

@ -629,17 +629,6 @@ void LP_smartutxos_push(struct iguana_info *coin)
vout = jint(item,"tx_pos");
value = j64bits(item,"value");
height = jint(item,"height");
#ifdef FROM_JS
//if ( 0 && (rand() % 100) == 0 && IAMLP == 0 )
{
struct LP_peerinfo *peer,*tmp; char *retstr;
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( (retstr= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 )
free(retstr);
}
}
#else
req = cJSON_CreateObject();
jaddstr(req,"method","uitem");
jaddstr(req,"coin",coin->symbol);
@ -650,7 +639,6 @@ void LP_smartutxos_push(struct iguana_info *coin)
jadd64bits(req,"value",value);
//printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0));
LP_reserved_msg(0,"","",zero,jprint(req,1));
#endif
}
}
free_json(array);

Loading…
Cancel
Save