From 3ba066affe8550c5b966089045137385f68d0a5a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 9 Jul 2017 21:31:06 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 8 ++++---- iguana/exchanges/LP_utxos.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index d44584f25..fe11b13c1 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -279,7 +279,7 @@ void LP_myutxo_updates(void *ctx,int32_t pubsock,char *passphrase) LP_privkey_updates(ctx,pubsock,passphrase,0); } -int32_t LP_peer_utxosquery(struct LP_peerinfo *mypeer,uint16_t myport,int32_t pubsock,struct LP_peerinfo *peer,uint32_t now,int32_t interval) +int32_t LP_peer_utxosquery(struct LP_peerinfo *mypeer,uint16_t myport,int32_t pubsock,struct LP_peerinfo *peer,uint32_t now,int32_t interval,int32_t maxentries) { int32_t lastn,n = -1; if ( peer->lastutxos < now-interval ) @@ -291,7 +291,7 @@ int32_t LP_peer_utxosquery(struct LP_peerinfo *mypeer,uint16_t myport,int32_t pu { peer->lastutxos = now; //printf("query utxos from %s\n",peer->ipaddr); - n = LP_utxosquery(mypeer,pubsock,peer->ipaddr,peer->port,"",lastn,mypeer != 0 ? mypeer->ipaddr : "127.0.0.1",myport); + n = LP_utxosquery(mypeer,pubsock,peer->ipaddr,peer->port,"",lastn,mypeer != 0 ? mypeer->ipaddr : "127.0.0.1",myport,maxentries); } } //else printf("LP_peer_utxosquery skip.(%s) %u\n",peer->ipaddr,peer->lastutxos); return(n); @@ -412,7 +412,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( lastn != n || n < 20 ) { lastn = n; - n = LP_peer_utxosquery(mypeer,myport,pubsock,peer,now,60); + n = LP_peer_utxosquery(mypeer,myport,pubsock,peer,now,60,100); } LP_peer_pricesquery(peer->ipaddr,peer->port); peer->diduquery = now; @@ -427,7 +427,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int if ( LP_mypeer != 0 && LP_mypeer->numutxos < mostutxos && mostpeer != 0 ) { printf("myutxos.%d most.%d %s\n",LP_mypeer->numutxos,mostutxos,mostpeer->ipaddr); - LP_peer_utxosquery(LP_mypeer,myport,pubsock,mostpeer,now,30); + LP_peer_utxosquery(LP_mypeer,myport,pubsock,mostpeer,now,60,(mostutxos-LP_mypeer->numutxos) * 2); //LP_peer_pricesquery(mostpeer->ipaddr,mostpeer->port); } if ( (counter % 6000) == 10 ) diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 9dac77905..efd21ea07 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -680,7 +680,7 @@ int32_t LP_utxosparse(char *destipaddr,uint16_t destport,char *retstr,uint32_t n return(n); } -int32_t LP_utxosquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *coin,int32_t lastn,char *myipaddr,uint16_t myport) +int32_t LP_utxosquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *coin,int32_t lastn,char *myipaddr,uint16_t myport,int32_t maxentries) { char *retstr; struct LP_peerinfo *peer; uint32_t now; int32_t retval = -1; peer = LP_peerfind((uint32_t)calc_ipbits(destipaddr),destport); @@ -688,8 +688,8 @@ int32_t LP_utxosquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa coin = ""; //printf("utxo query.(%s)\n",destipaddr); if ( IAMLP != 0 ) - retstr = issue_LP_getutxos(destipaddr,destport,coin,lastn,myipaddr,myport,mypeer != 0 ? mypeer->numpeers : 0,mypeer != 0 ? mypeer->numutxos : 0); - else retstr = issue_LP_clientgetutxos(destipaddr,destport,coin,100); + retstr = issue_LP_getutxos(destipaddr,destport,coin,lastn,myipaddr,myport,mypeer != 0 ? mypeer->numpeers : 0,maxentries); + else retstr = issue_LP_clientgetutxos(destipaddr,destport,coin,maxentries); if ( retstr != 0 ) { now = (uint32_t)time(NULL);