From cf9ebf00b602dba7342097fc70ebd325950ada58 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Jun 2017 13:59:50 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 6 ++++-- iguana/exchanges/LP_utxos.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index bccb9e1bf..24cc54375 100644 --- a/iguana/exchanges/LP_include.h +++ b/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]; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index ab7251b68..37edaeb03 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/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; inumpeers > 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; diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 055b37df3..2eb7b166c 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/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 ) {