Browse Source

Faster

beta
jl777 7 years ago
parent
commit
714be722e1
  1. 2
      iguana/exchanges/LP_include.h
  2. 22
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_transaction.c
  4. 4
      iguana/exchanges/LP_utxo.c

2
iguana/exchanges/LP_include.h

@ -182,7 +182,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 updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime;
uint32_t lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag;
char symbol[16],smartaddr[64],userpass[1024],serverport[128],lastunspent[64];
// portfolio

22
iguana/exchanges/LP_nativeDEX.c

@ -326,24 +326,19 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( (rand() % 10000) == 0 )
{
peer->errors--;
peer->diduquery = 0;
if ( peer->errors < LP_MAXPEER_ERRORS )
peer->diduquery = 0;
}
if ( IAMLP == 0 )
continue;
}
if ( now > peer->lastpeers+60 && peer->numpeers > 0 && (peer->numpeers != numpeers || (rand() % 10000) == 0) )
if ( now > peer->lastpeers+60 && peer->numpeers > 0 && (peer->numpeers != numpeers || (rand() % 1000) == 0) )
{
peer->lastpeers = now;
if ( strcmp(peer->ipaddr,myipaddr) != 0 )
{
LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport);
LP_peer_pricesquery(peer);
if ( peer->needping != 0 )
{
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);
peer->needping = 0;
}
peer->diduquery = 0;
}
}
if ( peer->diduquery == 0 )
@ -351,6 +346,12 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
LP_peer_pricesquery(peer);
peer->diduquery = now;
}
if ( peer->needping != 0 )
{
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);
peer->needping = 0;
}
}
if ( (counter % 6000) == 10 )
{
@ -368,8 +369,9 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( coin->rate != 0 )
coin->updaterate = 0;
}*/
if ( (rand() % 10000) == 0 )
if ( now > coin->lastutxos+60 || (rand() % 10000) == 0 )
{
coin->lastutxos = now;
post = 0;
LP_listunspent_both(coin->symbol,coin->smartaddr);
if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 )

2
iguana/exchanges/LP_transaction.c

@ -566,6 +566,8 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
//printf("value in vout.%d %.8f (%s)\n",vout,dstr(value),jprint(txobj,0));
}
free_json(txobj);
//if ( value != 0 )
// gettxout
}
if ( value == 0 )
{

4
iguana/exchanges/LP_utxo.c

@ -680,7 +680,9 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol
}
} // else printf("no val2\n");
}
char str[65],str2[65]; printf("spent.%d %s txid or value %.8f < %.8f or val2 %.8f < %.8f, %s/v%d %s/v%d or < 10x txfee %.8f\n",iambob,symbol,dstr(val),dstr(satoshis),dstr(val2),dstr(threshold),bits256_str(str,txid),vout,bits256_str(str2,txid2),vout2,dstr(txfee));
char str[65],str2[65];
if ( val != 0 && val2 != 0 )
printf("spent.%d %s txid or value %.8f < %.8f or val2 %.8f < %.8f, %s/v%d %s/v%d or < 10x txfee %.8f\n",iambob,symbol,dstr(val),dstr(satoshis),dstr(val2),dstr(threshold),bits256_str(str,txid),vout,bits256_str(str2,txid2),vout2,dstr(txfee));
if ( val == 0 )
LP_address_utxoadd(coin,destaddr,txid,vout,satoshis,-1,1);
if ( val2 == 0 )

Loading…
Cancel
Save