From f1a4e490c54fafabdbe2c240c004473b11aa7a38 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Nov 2017 14:47:30 +0400 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 5 +++++ iguana/exchanges/LP_zeroconf.c | 6 +++--- iguana/exchanges/stats.c | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index c3c66761d..e8ba59f54 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -273,7 +273,7 @@ struct iguana_info portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses; uint64_t txfee; int32_t numutxos,longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; - uint32_t loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; + uint32_t loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime,electrumzeroconf; uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms; char symbol[128],smartaddr[64],userpass[1024],serverport[128]; // portfolio diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5655b7ca8..518e9248b 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -555,6 +555,11 @@ void LP_coinsloop(void *_coins) coin->longestchain = LP_getheight(coin); if ( (ep= coin->electrum) != 0 ) { + if ( strcmp("KMD",coin->symbol) == 0 && coin->electrumzeroconf == 0 ) + { + LP_zeroconf_deposits(coin); + coin->electrumzeroconf = (uint32_t)time(NULL); + } if ( (backupep= ep->prev) == 0 ) backupep = ep; if ( (ap= LP_addressfind(coin,coin->smartaddr)) != 0 ) diff --git a/iguana/exchanges/LP_zeroconf.c b/iguana/exchanges/LP_zeroconf.c index 9b639bae3..bd2d09a9f 100644 --- a/iguana/exchanges/LP_zeroconf.c +++ b/iguana/exchanges/LP_zeroconf.c @@ -196,7 +196,7 @@ void LP_zeroconf_credit(char *coinaddr,uint64_t satoshis,int32_t weeki,char *p2s if ( coin != 0 ) { timestamp = LP_FIRSTWEEKTIME + weeki*LP_WEEKMULT; - if ( (ap= LP_address(coin,coinaddr)) != 0 ) //time(NULL) < timestamp-24*3600 && + if ( time(NULL) < timestamp-24*3600 && (ap= LP_address(coin,coinaddr)) != 0 ) { ap->zeroconf_credits += satoshis; printf("ZEROCONF credit.(%s) %.8f weeki.%d (%s) -> sum %.8f\n",coinaddr,dstr(satoshis),weeki,p2shaddr,dstr(ap->zeroconf_credits)); @@ -209,7 +209,7 @@ void LP_zeroconf_deposits(struct iguana_info *coin) cJSON *array,*item,*txjson,*vouts,*v,*txobj; int32_t i,n,numvouts,height,vout,weeki; bits256 txid; char destaddr[64],p2shaddr[64]; int64_t satoshis,amount64; if ( (array= LP_listreceivedbyaddress("KMD",BOTS_BONDADDRESS)) != 0 ) { - printf("ZEROCONF.(%s)\n",jprint(array,0)); + //printf("ZEROCONF.(%s)\n",jprint(array,0)); if ( (n= cJSON_GetArraySize(array)) > 0 ) { for (i=0; isymbol,p2shaddr,txid,0)) != 0 ) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 8ad7c94e1..a8a1c23ac 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -624,10 +624,12 @@ void LP_rpc_processreq(void *_ptr) printf("EAGAIN for len %d, remains.%d\n",len,remains); usleep(10000); } + printf("errno.%d len.%d remains.%d\n",errno,len,remains); break; } else { + printf("received len.%d\n",len); if ( len > 0 ) { buf[len] = 0; @@ -787,6 +789,7 @@ void stats_rpcloop(void *args) memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); if ( port == RPC_port && ipbits != localhostbits ) { + printf("port.%u RPC_port.%u ipbits %x != %x\n",port,RPC_port,ipbits,localhostbits); closesocket(sock); continue; }