Browse Source

Test

etomic
jl777 8 years ago
parent
commit
cf9ebf00b6
  1. 2
      iguana/exchanges/LP_include.h
  2. 6
      iguana/exchanges/LP_nativeDEX.c
  3. 2
      iguana/exchanges/LP_utxos.c

2
iguana/exchanges/LP_include.h

@ -178,7 +178,7 @@ struct LP_peerinfo
UT_hash_handle hh;
uint64_t ip_port;
double profitmargin;
uint32_t ipbits,errortime,errors,numpeers,numutxos,lasttime,connected;
uint32_t ipbits,errortime,errors,numpeers,numutxos,lasttime,connected,lastutxos;
int32_t pushsock,subsock;
uint16_t port;
char ipaddr[64];

6
iguana/exchanges/LP_nativeDEX.c

@ -80,7 +80,7 @@ char *blocktrail_listtransactions(char *symbol,char *coinaddr,int32_t num,int32_
void LP_mainloop(struct LP_peerinfo *mypeer,uint16_t mypubport,int32_t pubsock,int32_t pullsock,uint16_t myport,int32_t amclient,char *passphrase,double profitmargin)
{
//static uint16_t tmpport;
char *retstr; uint8_t r; int32_t i,n,j,len,recvsize,counter=0,nonz,lastn; struct LP_peerinfo *peer,*tmp; struct LP_utxoinfo *utxo,*utmp; void *ptr; cJSON *argjson;
char *retstr; uint8_t r; int32_t i,n,j,len,recvsize,counter=0,nonz,lastn; struct LP_peerinfo *peer,*tmp; uint32_t now; struct LP_utxoinfo *utxo,*utmp; void *ptr; cJSON *argjson;
if ( amclient == 0 )
{
for (i=0; i<sizeof(default_LPnodes)/sizeof(*default_LPnodes); i++)
@ -170,6 +170,7 @@ void LP_mainloop(struct LP_peerinfo *mypeer,uint16_t mypubport,int32_t pubsock,i
}
}
}
now = (uint32_t)time(NULL);
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( peer->numpeers > 0 && (peer->numpeers != mypeer->numpeers || (rand() % 10000) == 0) )
@ -179,8 +180,9 @@ void LP_mainloop(struct LP_peerinfo *mypeer,uint16_t mypubport,int32_t pubsock,i
if ( strcmp(peer->ipaddr,mypeer->ipaddr) != 0 )
LP_peersquery(amclient,mypeer,pubsock,peer->ipaddr,peer->port,mypeer->ipaddr,myport,profitmargin);
}
if ( peer->numutxos != mypeer->numutxos )
if ( peer->numutxos != mypeer->numutxos && now > peer->lastutxos+60 )
{
peer->lastutxos = now;
lastn = peer->numutxos - mypeer->numutxos + LP_PROPAGATION_SLACK;
if ( lastn < LP_PROPAGATION_SLACK * 2 )
lastn = LP_PROPAGATION_SLACK * 2;

2
iguana/exchanges/LP_utxos.c

@ -173,7 +173,7 @@ int32_t LP_utxosparse(int32_t amclient,struct LP_peerinfo *mypeer,int32_t mypubs
if ( utxo != 0 )
utxo->lasttime = now;
}
}
} else printf("skip.(%s)\n",jprint(item,0));
}
if ( (destpeer= LP_peerfind((uint32_t)calc_ipbits(destipaddr),destport)) != 0 )
{

Loading…
Cancel
Save