Browse Source

Test

etomic
jl777 7 years ago
parent
commit
147553ef53
  1. 2
      iguana/exchanges/LP_include.h
  2. 23
      iguana/exchanges/LP_nativeDEX.c
  3. 8
      iguana/exchanges/LP_signatures.c

2
iguana/exchanges/LP_include.h

@ -222,7 +222,7 @@ struct iguana_info
portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses;
uint64_t txfee;
int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport;
uint32_t lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;
uint32_t lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms;
char symbol[16],smartaddr[64],userpass[1024],serverport[128];
// portfolio

23
iguana/exchanges/LP_nativeDEX.c

@ -619,9 +619,10 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( strcmp(peer->ipaddr,myipaddr) != 0 )
{
nonz++;
#ifndef FROM_JS
LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport);
#ifdef FROM_JS
if ( (rand() % 100) == 0 )
#endif
LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport);
peer->diduquery = 0;
LP_peer_pricesquery(peer);
LP_utxos_sync(peer);
@ -633,23 +634,25 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
{
peer->diduquery = now;
nonz++;
#ifndef FROM_JS
#ifdef FROM_JS
if ( (rand() % 100) == 0 )
#endif
if ( (retstr= issue_LP_notify(peer->ipaddr,peer->port,"127.0.0.1",0,numpeers,G.LP_sessionid,G.LP_myrmd160str,G.LP_mypub25519)) != 0 )
free(retstr);
#endif
peer->needping = 0;
needpings++;
}
}
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{
if ( coin->addr_listunspent_requested != 0 )
if ( coin->addr_listunspent_requested != 0 && time(NULL) > coin->lastpushtime+60 )
{
//printf("PUSH addr_listunspent_requested %u\n",coin->addr_listunspent_requested);
coin->lastpushtime = (uint32_t)time(NULL);
LP_smartutxos_push(coin);
coin->addr_listunspent_requested = 0;
}
if ( coin->inactive == 0 && time(NULL) > coin->lastgetinfo+LP_GETINFO_INCR )
if ( coin->electrum == 0 && coin->inactive == 0 && time(NULL) > coin->lastgetinfo+LP_GETINFO_INCR )
{
nonz++;
if ( (height= LP_getheight(coin)) > coin->longestchain )
@ -1073,12 +1076,12 @@ void LP_fromjs_iter()
ctx = bitcoin_ctx();
if ( 0 && (LP_counter % 100) == 0 )
printf("LP_fromjs_iter got called LP_counter.%d userpass.(%s) ctx.%p\n",LP_counter,G.USERPASS,ctx);
if ( Nanomsg_threadarg != 0 )
nn_thread_main_routine(Nanomsg_threadarg);
//if ( Nanomsg_threadarg != 0 )
// nn_thread_main_routine(Nanomsg_threadarg);
//LP_pubkeys_query();
//LP_utxosQ_process();
LP_nanomsg_recvs(ctx);
//LP_mainloop_iter(ctx,LP_myipaddr,0,LP_mypubsock,LP_publicaddr,LP_RPCPORT);
//LP_nanomsg_recvs(ctx);
LP_mainloop_iter(ctx,LP_myipaddr,0,LP_mypubsock,LP_publicaddr,LP_RPCPORT);
//queue_loop(0);
if ( 0 && (LP_counter % 10) == 0 ) // 10 seconds
{

8
iguana/exchanges/LP_signatures.c

@ -584,7 +584,7 @@ char *LP_notify_recv(cJSON *argjson)
void LP_smartutxos_push(struct iguana_info *coin)
{
struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 zero,txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item,*req;
uint64_t value; bits256 zero,txid; int32_t i,vout,height,n; cJSON *array,*item,*req;
if ( coin->smartaddr[0] == 0 )
return;
//LP_notify_pubkeys(coin->ctx,LP_mypubsock);
@ -601,14 +601,17 @@ void LP_smartutxos_push(struct iguana_info *coin)
vout = jint(item,"tx_pos");
value = j64bits(item,"value");
height = jint(item,"height");
if ( 0 && (rand() % 100) == 0 && IAMLP == 0 )
#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);
@ -619,6 +622,7 @@ void LP_smartutxos_push(struct iguana_info *coin)
jadd64bits(req,"value",value);
//printf("ADDR_UNSPENTS[] <- %s\n",jprint(req,0));
LP_reserved_msg("","",zero,jprint(req,1));
#endif
}
}
free_json(array);

Loading…
Cancel
Save